Commit a9b1383b authored by Julia Qiu's avatar Julia Qiu Committed by Tim Neutkens

Fix @babel/env modules config (#5119)

Probably an oversight but currently env preset's `modules` option always evaluates to 'auto'. We probably want it to be set to false, especially in prod, to have Webpack handle modules natively.
parent 48c48975
...@@ -33,7 +33,7 @@ module.exports = (context, opts = {}) => ({ ...@@ -33,7 +33,7 @@ module.exports = (context, opts = {}) => ({
[require('@babel/preset-env').default, { [require('@babel/preset-env').default, {
// In the test environment `modules` is often needed to be set to true, babel figures that out by itself using the `'auto'` option // In the test environment `modules` is often needed to be set to true, babel figures that out by itself using the `'auto'` option
// In production/development this option is set to `false` so that webpack can handle import/export with tree-shaking // In production/development this option is set to `false` so that webpack can handle import/export with tree-shaking
modules: isDevelopment && isProduction ? false : 'auto', modules: isDevelopment || isProduction ? false : 'auto',
...opts['preset-env'] ...opts['preset-env']
}], }],
[require('@babel/preset-react'), { [require('@babel/preset-react'), {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment