From dc65123da856a09fe346ccd851cb4b78ad07ce5c Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 19 Jul 2021 11:48:18 +0200 Subject: 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. --- opendc-web/opendc-web-ui/next.config.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'opendc-web/opendc-web-ui/next.config.js') 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 + } }) -- cgit v1.2.3