Minor build performance improvement for dev mode

This commit is contained in:
SleepWalker 2019-11-09 14:13:24 +02:00
parent 3b06d9d2ea
commit 3a9d81cf57
3 changed files with 12 additions and 0 deletions

View File

@ -98,6 +98,7 @@
"csp-webpack-plugin": "^2.0.2", "csp-webpack-plugin": "^2.0.2",
"css-loader": "^3.0.0", "css-loader": "^3.0.0",
"cssnano": "^4.1.10", "cssnano": "^4.1.10",
"eager-imports-webpack-plugin": "^1.0.0",
"enzyme": "^3.8.0", "enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1", "enzyme-adapter-react-16": "^1.7.1",
"eslint": "^4.0.0", "eslint": "^4.0.0",

View File

@ -11,6 +11,7 @@ const SitemapPlugin = require('sitemap-webpack-plugin').default;
const CSPPlugin = require('csp-webpack-plugin'); const CSPPlugin = require('csp-webpack-plugin');
const WebpackBar = require('webpackbar'); const WebpackBar = require('webpackbar');
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin'); const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const EagerImportsPlugin = require('eager-imports-webpack-plugin').default;
const SUPPORTED_LANGUAGES = Object.keys(require('./src/i18n/index.json')); const SUPPORTED_LANGUAGES = Object.keys(require('./src/i18n/index.json'));
const localeFlags = require('./src/components/i18n/localeFlags').default; const localeFlags = require('./src/components/i18n/localeFlags').default;
@ -275,6 +276,11 @@ if (isProduction) {
}; };
} else { } else {
webpackConfig.plugins.push( webpackConfig.plugins.push(
// force webpack to use mode: eager chunk imports in dev mode
// this will improve build performance
// this mode will be default for dev builds in webpack 5
new EagerImportsPlugin(),
new webpack.DllReferencePlugin({ new webpack.DllReferencePlugin({
context: __dirname, context: __dirname,
manifest: require('./dll/vendor.json') manifest: require('./dll/vendor.json')

View File

@ -3417,6 +3417,11 @@ duplexify@^3.4.2, duplexify@^3.6.0:
readable-stream "^2.0.0" readable-stream "^2.0.0"
stream-shift "^1.0.0" stream-shift "^1.0.0"
eager-imports-webpack-plugin@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/eager-imports-webpack-plugin/-/eager-imports-webpack-plugin-1.0.0.tgz#c78d0ab0309909330b14618fdd5942aa2c835d38"
integrity sha512-CyqTedChn2zYuqscxtr2e491lL3Gw+1Mgoy4R+TiX8S2x2DtWkdCjqmhrmq2+82EuKAdONZW4FpLZOdo64Jwhw==
ecc-jsbn@~0.1.1: ecc-jsbn@~0.1.1:
version "0.1.2" version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"