-
-
Notifications
You must be signed in to change notification settings - Fork 601
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
feat(node-resolve): add ignoreSideEffectsForRoot
option
#694
Conversation
I'm not sure if this is a bug, why should side effects setting not apply to the project itself? |
Yeh I was wondering this. I think if the package.json option is |
I'm not sure about the behavior too. However I think it should be as least documented, or maybe made as an option? For example I'm making a non-side-effects library, and the doc site is placed in the project root too. If I use rollup to create a doc site bundle (which vite does), css (for the site) may be shaken by rollup. When I apply Currently I need to remove What makes things confused is that
If you only use node resolve for extension resolving (not using any module from node_modules), you will find bundle result differs with or without |
Finally got around to trying this with webpack. If you
the output build is empty, so it looks like webpack works the same way the plugin does currently. So maybe we should keep the plugin consistent with webpack? I agree it could be a bit confusing though if you're not using |
It might be worth comparing to webpack@4, since v5 is still a bit of a trash can fire. |
With webpack 4.44.2 it also does not include 'side-effect.js' with |
I think webpack has set good precedent here and following their lead is reasonable. I also think documenting this as suggested by @07akioni is a great idea. @LarsDenBakker and @07akioni could you take another look at this one please? |
So if we are following webpack we should close this PR and update the docs. @LarsDenBakker just saw you approved. Do you think we should do different to weback? |
Sorry I misunderstood, I thought webpack does what youre proposing in this PR. Lets keep it as is then. |
😆 I'll wait from direction from you both on when/if to merge. |
I think given webpack introduced this(?) we should match their behaviour by default. We could update this pr to add an If we think it's worth it I can add that otherwise fine closing this. |
I'm good adding that option. |
sideEffects
property for root packageignoreSideEffectsForRoot
option
@shellscape done! @07akioni |
Hope this can be merged soon. 😄 |
Rollup Plugin Name:
resolve
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers: #692
Description
Use the
rootDir
option to determine if the file being resolved is in the root package, and if it is do not respect the package.jsonside-effects
option, providingignoreSideEffectsForRoot
istrue
.Note the default is remaining as
false
and we are not treating this as a bug, becausefalse
matches the default behaviour in webpack.Refs #692