Skip to content

Commit bda3877

Browse files
committed
chore: update Webpack to the latest version + update build config to be better optimized for production — workaround to the normal production mode not fully rendering all components as expected
1 parent d8efd9d commit bda3877

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

packages/uikit-workshop/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
"sass-loader": "^7.1.0",
6262
"style-loader": "^0.23.1",
6363
"uglifyjs-webpack-plugin": "^1.2.7",
64-
"webpack": "4.16.3",
65-
"webpack-cli": "^3.1.0",
64+
"webpack": "4.26.3",
65+
"webpack-cli": "^3.1.2",
6666
"workbox-build": "^3.4.1",
6767
"yargs": "^12.0.1"
6868
},

packages/uikit-workshop/webpack.config.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const explorer = cosmiconfig('patternlab');
1515
// @todo: wire these two ocnfigs up to use cosmicconfig!
1616
const defaultConfig = {
1717
buildDir: './dist',
18-
prod: false, // or false for local dev
18+
prod: true, // or false for local dev
1919
sourceMaps: true,
2020
publicPath: '/styleguide/',
2121
};
@@ -180,10 +180,28 @@ module.exports = async function() {
180180
],
181181
},
182182
cache: true,
183-
mode: config.prod ? 'production' : 'development',
183+
// mode: config.prod ? 'production' : 'development',
184+
mode: 'development', // temp workaround till strange rendering issues with full `production` mode are switched on in Webpack
184185
optimization: {
186+
minimize: true,
187+
occurrenceOrder: true,
188+
namedChunks: true,
189+
removeAvailableModules: true,
190+
removeEmptyChunks: true,
191+
nodeEnv: 'production',
185192
mergeDuplicateChunks: true,
186193
concatenateModules: true,
194+
splitChunks: {
195+
chunks: 'async',
196+
cacheGroups: {
197+
vendors: {
198+
test: /[\\/]node_modules[\\/]/,
199+
name: 'vendors',
200+
chunks: 'async',
201+
reuseExistingChunk: true,
202+
},
203+
},
204+
},
187205
minimizer: config.prod
188206
? [
189207
new UglifyJsPlugin({

0 commit comments

Comments
 (0)