diff --git a/package-lock.json b/package-lock.json index 1138b9d702e..b08138a3e46 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33581,6 +33581,7 @@ "semver": "7.3.5", "source-map-loader": "^1.1.2", "style-loader": "3.0.0", + "terser-webpack-plugin": "^5.1.4", "webpack": "5.41.1", "webpack-dev-server": "4.0.0", "webpack-manifest-plugin": "3.1.1", @@ -54609,6 +54610,7 @@ "semver": "7.3.5", "source-map-loader": "^1.1.2", "style-loader": "3.0.0", + "terser-webpack-plugin": "^5.1.4", "webpack": "5.41.1", "webpack-dev-server": "4.0.0", "webpack-manifest-plugin": "3.1.1", diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 6bc8b2cee11..7f3b2234dd2 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -47,9 +47,12 @@ const reactRefreshWebpackPluginRuntimeEntry = require.resolve( ); const babelRuntimeEntry = require.resolve('babel-preset-react-app'); const babelRuntimeEntryHelpers = require.resolve( - '@babel/runtime/helpers/esm/assertThisInitialized' + '@babel/runtime/helpers/esm/assertThisInitialized', + { paths: [babelRuntimeEntry] } ); -const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator'); +const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', { + paths: [babelRuntimeEntry], +}); // Some apps do not need the benefits of saving a web request, so not inlining the chunk // makes for a smoother build process. @@ -329,7 +332,7 @@ module.exports = function (webpackEnv) { enforce: 'pre', exclude: /@babel(?:\/|\\{1,2})runtime/, test: /\.(js|mjs|jsx|ts|tsx|css)$/, - use: 'source-map-loader', + loader: require.resolve('source-map-loader'), }, { // "oneOf" will traverse all following loaders until one will @@ -364,7 +367,7 @@ module.exports = function (webpackEnv) { test: /\.svg$/, use: [ { - loader: '@svgr/webpack', + loader: require.resolve('@svgr/webpack'), options: { prettier: false, svgo: false, @@ -376,7 +379,7 @@ module.exports = function (webpackEnv) { }, }, { - loader: 'file-loader', + loader: require.resolve('file-loader'), options: { name: 'static/media/[name].[hash].[ext]', }, diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 8f73cc0aeae..454cbf94ec4 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -70,6 +70,7 @@ "semver": "7.3.5", "source-map-loader": "^1.1.2", "style-loader": "3.0.0", + "terser-webpack-plugin": "^5.1.4", "webpack": "5.41.1", "webpack-dev-server": "4.0.0", "webpack-manifest-plugin": "3.1.1",