Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable decorator transforms in case we are using a different decorator transform plugin #601

Open
vstefanovic97 opened this issue Nov 27, 2023 · 1 comment

Comments

@vstefanovic97
Copy link
Contributor

vstefanovic97 commented Nov 27, 2023

We started using https://github.com/ef4/decorator-transforms to build our v2 Ember addons.
But when we actually use this addons in our application I noticed some transpilations were happening that shouldn't be there.

Basically when I build the addon code with rollup I can see the addon code is using a lot of modern features like static blocks, private fields etc., but when I inspect the bundle for the addon generated by the main apps build it seems that all that stuff gets transpiled away (even though our browser targets are all latest browsers that should support such syntax)

After some digging around I noticed that these plugins seem to run always, and they are the root cause of this transpilation.

It would be nice if we had an option to not include any of these if we want, like for ember-cli-babel we have the disableDecoratorTransforms option.

Here is a repo with reproduction (See chunk.143 in dists)
https://github.com/vstefanovic97/ember-auto-import-decorator-transpilation-example

I left my-app/dist and my-app/dist-when-i-manually-remove-plugins-from-node-modules-ember-auto-import commited on purpose so you can see the difference w/o having to do a build.

For my-app/dist I just ran production build w/o changing anything, but for my-app/dist-when-i-manually-remove-plugins-from-node-modules-ember-auto-import I ran production build while manually removing those plugins from node_modules/ember-auto-import

@ef4
Copy link
Collaborator

ef4 commented Nov 27, 2023

ember-auto-import's standard babel config still needs some decorator support. The app's babel config does not apply to auto-imported dependencies. So I think the option you'd want to add is one that would switch ember-auto-import to use decorator-transforms instead of @babel/plugin-proposal-decorators.

I think it would need to be an option because if we made it the default it would be a breaking change to our supported browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants