From 40637fe55bb91d225a6fa1dcdeb41557ec614e5c Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 22 Aug 2018 17:01:05 +0200 Subject: [PATCH] Additional webpack splitting config (#253) * Additional webpack splitting config * Adjust bundles * Naming of bundles --- package.json | 1 + packages/apps/webpack.config.js | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 26b6c26449..aea441e4fe 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "typescript": "^3.0.1" }, "scripts": { + "analyze": "yarn run build && cd packages/apps && yarn run source-map-explorer build/main.*.js", "build": "polkadot-dev-build-ts", "check": "tslint --project . && tsc --noEmit", "clean": "polkadot-dev-clean-build", diff --git a/packages/apps/webpack.config.js b/packages/apps/webpack.config.js index dbf4ac2cd9..21a868b21b 100644 --- a/packages/apps/webpack.config.js +++ b/packages/apps/webpack.config.js @@ -142,11 +142,23 @@ function createWebpack ({ alias = {}, context, name = 'index' }) { runtimeChunk: 'single', splitChunks: { cacheGroups: { - vendor: { + vendorOther: { chunks: 'initial', enforce: true, name: 'vendor', - test: /node_modules\/(bn\.js|i18next|lodash|react|semantic-ui)/ + test: /node_modules\/(asn1|bn\.js|buffer|cuint|elliptic|lodash|moment|readable-stream|rxjs)/ + }, + vendorReact: { + chunks: 'initial', + enforce: true, + name: 'react', + test: /node_modules\/(chart|i18next|react|semantic-ui)/ + }, + vendorSodium: { + chunks: 'initial', + enforce: true, + name: 'sodium', + test: /node_modules\/(libsodium)/ } } } @@ -155,6 +167,7 @@ function createWebpack ({ alias = {}, context, name = 'index' }) { hints: false }, plugins: plugins.concat([ + new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(ENV),