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:
parent
48c48975c4
commit
a9b1383b5d
|
@ -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'), {
|
||||||
|
|
Loading…
Reference in a new issue