Skip to content

Commit 4ba7f76

Browse files
authored
Merge pull request #18934 from mozilla/webpack-chunk-optimizations
task(settings): Improve webpack chunking
2 parents 8d5332f + fd224e4 commit 4ba7f76

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

packages/fxa-settings/config/webpack.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,30 @@ module.exports = function (webpackEnv) {
305305
// This is only used in production mode
306306
new CssMinimizerPlugin(),
307307
],
308+
splitChunks: isEnvProduction ? {
309+
cacheGroups: {
310+
presentation: {
311+
test: /[\\/]node_modules[\\/]react|react-dom|@reach|@fluent[\\/]/,
312+
name: 'presentation-chunk',
313+
chunks: 'all',
314+
},
315+
utils: {
316+
test: /[\\/]node_modules[\\/]moment|lodash|ua-parser-js[\\/]/,
317+
name: 'utils-chunk',
318+
chunks: 'all',
319+
},
320+
observability: {
321+
test: /([\\/]node_modules[\\/]@sentry.*[\\/])|([\\/]glean[\\/])/,
322+
name: 'observability-chunk',
323+
chunks: 'all',
324+
},
325+
networking: {
326+
test: /([\\/]node_modules[\\/]graphql|graphql-tag|@apollo.*[\\/])|([\\/]fxa-auth-client[\\/])/,
327+
name: 'networking-chunk',
328+
chunks: 'all',
329+
},
330+
},
331+
} : {}
308332
},
309333
resolve: {
310334
// This allows you to set a fallback for where webpack should look for modules.

0 commit comments

Comments
 (0)