Additional webpack splitting config (#253)

* Additional webpack splitting config

* Adjust bundles

* Naming of bundles
This commit is contained in:
Jaco Greeff 2018-08-22 17:01:05 +02:00 committed by GitHub
parent d4cf3c4d36
commit 40637fe55b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -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",

View File

@ -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),