diff --git a/lib/core/package.json b/lib/core/package.json index fb44097e774..a3bbb88a4e7 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -82,6 +82,7 @@ "style-loader": "^0.23.1", "svg-url-loader": "^2.3.2", "url-loader": "^1.1.2", + "terser-webpack-plugin": "^1.1.0", "webpack": "^4.23.1", "webpack-dev-middleware": "^3.4.0", "webpack-hot-middleware": "^2.24.3" diff --git a/lib/core/src/server/preview/iframe-webpack.config.js b/lib/core/src/server/preview/iframe-webpack.config.js index b1408691f83..56d154b4341 100644 --- a/lib/core/src/server/preview/iframe-webpack.config.js +++ b/lib/core/src/server/preview/iframe-webpack.config.js @@ -4,6 +4,7 @@ import Dotenv from 'dotenv-webpack'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin'; import WatchMissingNodeModulesPlugin from 'react-dev-utils/WatchMissingNodeModulesPlugin'; +import TerserWebpackPlugin from 'terser-webpack-plugin'; import { includePaths, @@ -95,6 +96,16 @@ export default ({ chunks: 'all', }, runtimeChunk: true, + minimizer: [ + new TerserWebpackPlugin({ + cache: true, + parallel: true, + sourceMap: true, + terserOptions: { + mangle: false, + }, + }), + ], }, performance: { hints: isProd ? 'warning' : false, diff --git a/yarn.lock b/yarn.lock index 5afff4b9a41..0a95f611d20 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21370,7 +21370,7 @@ term-size@^1.2.0: dependencies: execa "^0.7.0" -terser-webpack-plugin@1.1.0: +terser-webpack-plugin@1.1.0, terser-webpack-plugin@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.1.0.tgz#cf7c25a1eee25bf121f4a587bb9e004e3f80e528" integrity sha512-61lV0DSxMAZ8AyZG7/A4a3UPlrbOBo8NIQ4tJzLPAdGOQ+yoNC7l5ijEow27lBAL2humer01KLS6bGIMYQxKoA==