From 3a9d81cf57cbb6f998951913945c2846a9af2d8f Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sat, 9 Nov 2019 14:13:24 +0200 Subject: [PATCH] Minor build performance improvement for dev mode --- package.json | 1 + webpack.config.js | 6 ++++++ yarn.lock | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/package.json b/package.json index 77dddc0..853f1e7 100644 --- a/package.json +++ b/package.json @@ -98,6 +98,7 @@ "csp-webpack-plugin": "^2.0.2", "css-loader": "^3.0.0", "cssnano": "^4.1.10", + "eager-imports-webpack-plugin": "^1.0.0", "enzyme": "^3.8.0", "enzyme-adapter-react-16": "^1.7.1", "eslint": "^4.0.0", diff --git a/webpack.config.js b/webpack.config.js index f9ae67b..17665d7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,6 +11,7 @@ const SitemapPlugin = require('sitemap-webpack-plugin').default; const CSPPlugin = require('csp-webpack-plugin'); const WebpackBar = require('webpackbar'); 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 localeFlags = require('./src/components/i18n/localeFlags').default; @@ -275,6 +276,11 @@ if (isProduction) { }; } else { 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({ context: __dirname, manifest: require('./dll/vendor.json') diff --git a/yarn.lock b/yarn.lock index 8d85982..29e5261 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3417,6 +3417,11 @@ duplexify@^3.4.2, duplexify@^3.6.0: readable-stream "^2.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: version "0.1.2" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"