You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I looked around, and found #1177 that may be somewhat similar, but it doesn't seem to quite be the same thing.
Feature Use Case
When commonjs emits code, in some situations it creates a module that has side effects. This can be problematic for library authors who have the sideEffects field in package.json, as they then are required to figure out which emitted modules have side effects, track them down, and then add them to the sideEffects array.
For more context, this issue was originally raised in the Vite repo here: vitejs/vite#10866 (comment) but was eventually found to be an issue with (probably?) the commonjs plugin.
Here's a StackBlitz example of the emitted code that has a side effect:
The first import must not be treeshaked/removed, as it has the side effect of making the second import work. However, as a library author, it was very difficult for me to find this out as the side effect doesn't exist in my library and was the result of a transformation of a transitive dep.
Feature Proposal
Is it possible to change the emitted code to be self contained and not side-effect-y?
If not, is it somehow possible to notify the dev that modules with side effects were created, so that I could be aware of it and add it to my package.json's sideEffect array?
Thanks!
The text was updated successfully, but these errors were encountered:
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ
I looked around, and found #1177 that may be somewhat similar, but it doesn't seem to quite be the same thing.
Feature Use Case
When commonjs emits code, in some situations it creates a module that has side effects. This can be problematic for library authors who have the
sideEffects
field in package.json, as they then are required to figure out which emitted modules have side effects, track them down, and then add them to thesideEffects
array.For more context, this issue was originally raised in the Vite repo here: vitejs/vite#10866 (comment) but was eventually found to be an issue with (probably?) the commonjs plugin.
Here's a StackBlitz example of the emitted code that has a side effect:
https://stackblitz.com/edit/rollup-template-1kqybv?file=dist%2Fnode_modules%2Fuse-sync-external-store%2Fshim%2Fwith-selector.js,rollup.config.js
The file
dist/node_modules/@xstate/react/es/fsm.js
has two imports:The first import must not be treeshaked/removed, as it has the side effect of making the second import work. However, as a library author, it was very difficult for me to find this out as the side effect doesn't exist in my library and was the result of a transformation of a transitive dep.
Feature Proposal
Is it possible to change the emitted code to be self contained and not side-effect-y?
If not, is it somehow possible to notify the dev that modules with side effects were created, so that I could be aware of it and add it to my package.json's
sideEffect
array?Thanks!
The text was updated successfully, but these errors were encountered: