diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 502736ead11..6a0c7e16bbe 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -165,7 +165,7 @@ module.exports = function (webpackEnv) { return loaders; }; - return { + const config = { mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development', // Stop compilation early in production bail: isEnvProduction, @@ -790,4 +790,12 @@ module.exports = function (webpackEnv) { // our own hints via the FileSizeReporter performance: false, }; + + if (appPackageJson.adjustWebpackConfig) { + const adjustWebpackConfigPath = path.join(path.dirname(paths.appPackageJson), appPackageJson.adjustWebpackConfig) + const adjustWebpackConfig = require(adjustWebpackConfigPath); + return adjustWebpackConfig(config); + } + + return config; };