summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/next.config.js
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-19 11:48:18 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-19 11:48:18 +0200
commitdc65123da856a09fe346ccd851cb4b78ad07ce5c (patch)
treedefc5c96c95501d6e93e42bd7c5b8bff40bd66ab /opendc-web/opendc-web-ui/next.config.js
parentf2aeecccc096728d3df955b71e711c8d9c429427 (diff)
perf(ui): Split transpiled modules into separate chunk
This change updates the Next.js/Webpack configuration of the OpenDC frontend to split transpiled modules into a separate chunk during development. This prevents the duplication of the transpiled modules across the compiled files.
Diffstat (limited to 'opendc-web/opendc-web-ui/next.config.js')
-rw-r--r--opendc-web/opendc-web-ui/next.config.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-ui/next.config.js b/opendc-web/opendc-web-ui/next.config.js
index 9092adc4..1dfe4156 100644
--- a/opendc-web/opendc-web-ui/next.config.js
+++ b/opendc-web/opendc-web-ui/next.config.js
@@ -43,4 +43,18 @@ module.exports = withTM({
},
]
},
+ webpack: (config, options) => {
+ if (options.dev) {
+ config.optimization.splitChunks = {
+ cacheGroups: {
+ vendor: {
+ test: /[\\/]node_modules[\\/]/,
+ name: 'transpiled-modules',
+ chunks: 'all',
+ },
+ },
+ }
+ }
+ return config
+ }
})