1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

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.
This commit is contained in:
Julia Qiu 2018-09-07 02:42:10 -07:00 committed by Tim Neutkens
parent 48c48975c4
commit a9b1383b5d

View file

@ -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'), {