From ae8ce43bc818a3dfb304eb55092c175b7ad4955d Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Fri, 9 Sep 2022 11:01:51 -0700 Subject: [PATCH] Update webpack output names Context: in webpack v5, the files associated with the "core-vendors" custom group are classified as initial (entry-point) chunk files [1] when that was not the case in webpack v4. Not sure why. Add [name] to filename to be more consistent with chunkFilename, and so it's easier to understand the association between files and cacheGroups. Update the bundlesize config glob patterns to match these new names. Since the exact reason for filename vs. chunkFilename isn't clear to me, I updated all glob patterns to match either. [1]: https://webpack.js.org/configuration/output/#outputchunkfilename --- bundlesize.config.json | 10 +++++----- webpack.config.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bundlesize.config.json b/bundlesize.config.json index 0b5d9cea7..8e6c2fbd4 100644 --- a/bundlesize.config.json +++ b/bundlesize.config.json @@ -1,23 +1,23 @@ { "files": [ { - "path": "./dist/auspice.bundle.*.js", + "path": "./dist/auspice.main.bundle.*.js", "maxSize": "2 kB" }, { - "path": "./dist/auspice.chunk.+([0-9]).bundle.*.js", + "path": "./dist/auspice.?(chunk.)+([0-9]).bundle.*.js", "maxSize": "100 kB" }, { - "path": "./dist/auspice.chunk.core-vendors.bundle.*.js", + "path": "./dist/auspice.?(chunk.)core-vendors.bundle.*.js", "maxSize": "220 kB" }, { - "path": "./dist/auspice.chunk.other-vendors.bundle.*.js", + "path": "./dist/auspice.?(chunk.)other-vendors.bundle.*.js", "maxSize": "150 kB" }, { - "path": "./dist/auspice.chunk.locales.bundle.*.js", + "path": "./dist/auspice.?(chunk.)locales.bundle.*.js", "maxSize": "100 kB" } ] diff --git a/webpack.config.js b/webpack.config.js index 243495953..7595a112d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -186,7 +186,7 @@ const generateConfig = ({extensionPath, devMode=false, customOutputPath, analyze entry, output: { path: outputPath, - filename: `auspice.bundle${!devMode ? ".[contenthash]" : ""}.js`, + filename: `auspice.[name].bundle${!devMode ? ".[contenthash]" : ""}.js`, chunkFilename: `auspice.chunk.[name].bundle${!devMode ? ".[chunkhash]" : ""}.js`, publicPath: "/dist/" },