diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index db371dda6e8..a72aa0b265f 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -137,6 +137,9 @@ module.exports = { // It is guaranteed to exist because we tweak it in `env.js` process.env.NODE_PATH.split(path.delimiter).filter(Boolean) ), + // Since create-react-app doesn't support all ES6 features in dependencies, + // prefer to load the ES5 instead of the ES6 if a package provides both. + mainFields: ['browser', 'main', 'module'], // These are the reasonable defaults supported by the Node ecosystem. // We also include JSX as a common component filename extension to support // some tools, although we do not recommend using it, see: diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 86869748c66..ac4324e05c9 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -175,6 +175,9 @@ module.exports = { // It is guaranteed to exist because we tweak it in `env.js` process.env.NODE_PATH.split(path.delimiter).filter(Boolean) ), + // Since create-react-app doesn't support all ES6 features in dependencies, + // prefer to load the ES5 over the ES6 if a package provides both. + mainFields: ['browser', 'main', 'module'], // These are the reasonable defaults supported by the Node ecosystem. // We also include JSX as a common component filename extension to support // some tools, although we do not recommend using it, see: