Add modules: false by default for es2015/env/latest presets#650
Add modules: false by default for es2015/env/latest presets#650SpaceK33z wants to merge 2 commits intobabel:masterfrom SpaceK33z:disable-modules-default
modules: false by default for es2015/env/latest presets#650Conversation
|
I think there should be something done, because current situation is way from ideal and people shouldn't worry about it (unless they want to). But change such as this doesnt account for |
|
@Andarist, you're right, it doesn't work for Spent some time trying to fix this, but got stuck at not being able to mutate the |
I'm not familiar with config loading myself. In general I think it would be better to validate the config rather than mutate it, but also ain't sure how to do it right now. @loganfsmyth should know if it's even possible right now, or if there is anything that can be done in babel itself to make this use case easier. |
|
Seems like this should be closed in favour of #660 . Thanks for making this PR - it certainly pushed the needed changes forward so that this can get resolved once and for all now :) |
Note this is an update version of PR #529.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
See #521.
What is the new behavior?
The Babel presets
env,latestandes2015will be mutated to addmodules: falseas an option. This also works when you use e.g.@babel/preset-envor@babel/env.Does this PR introduce a breaking change?
For people who use babel-loader without setting the
modulesoption, there might be small differences in the way webpack handles ES modules.For people who still want to keep the old behavior, they can explicitly add
modules: trueor e.g.modules: "amd".Other information:
I am not happy at all with the implementation, but it works. Let me know if there is a better way I missed.
I used parts of the code in #485, so credits to @wardpeet!
Fixes #521, fixes #477, fixes #485