From a8b42bcd50ce0fd3ba499b0c88f64faebdc2ed0f Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Mon, 15 Jan 2024 09:47:09 -0800 Subject: [PATCH] Change the vite chunk filename hash usage (#2224) * Change the vite chunk filename hash usage - Change to more closely match the . syntax we use with webpack - This should fix some issues with our size compare as well * Account for chunks being base64 --- .github/workflows/size-compare.yml | 4 ++++ packages/desktop-client/vite.config.mts | 6 +++--- upcoming-release-notes/2224.md | 6 ++++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 upcoming-release-notes/2224.md diff --git a/.github/workflows/size-compare.yml b/.github/workflows/size-compare.yml index 40da2aad61..2db0cd588b 100644 --- a/.github/workflows/size-compare.yml +++ b/.github/workflows/size-compare.yml @@ -64,7 +64,11 @@ jobs: - name: Strip content hashes from stats files run: | + sed -i -E 's/index\.[0-9a-zA-Z_-]{8,}\./index./g' ./head/web-stats.json + sed -i -E 's/\.[0-9a-zA-Z_-]{8,}\.chunk\././g' ./head/web-stats.json sed -i -E 's/\.[0-9a-f]{8,}\././g' ./head/*.json + sed -i -E 's/index\.[0-9a-zA-Z_-]{8,}\./index./g' ./base/web-stats.json + sed -i -E 's/\.[0-9a-zA-Z_-]{8,}\.chunk\././g' ./base/web-stats.json sed -i -E 's/\.[0-9a-f]{8,}\././g' ./base/*.json - uses: twk3/rollup-size-compare-action@v1.0.0 with: diff --git a/packages/desktop-client/vite.config.mts b/packages/desktop-client/vite.config.mts index 513216ae46..68d1d8fbec 100644 --- a/packages/desktop-client/vite.config.mts +++ b/packages/desktop-client/vite.config.mts @@ -123,10 +123,10 @@ export default defineConfig(async ({ mode }) => { } else if (/woff|woff2/.test(extType)) { extType = 'media'; } - return `static/${extType}/[name]-[hash][extname]`; + return `static/${extType}/[name].[hash][extname]`; }, - chunkFileNames: 'static/js/[name]-[hash].js', - entryFileNames: 'static/js/[name]-[hash].js', + chunkFileNames: 'static/js/[name].[hash].chunk.js', + entryFileNames: 'static/js/[name].[hash].js', }, }, }, diff --git a/upcoming-release-notes/2224.md b/upcoming-release-notes/2224.md new file mode 100644 index 0000000000..5b2274ea93 --- /dev/null +++ b/upcoming-release-notes/2224.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [twk3] +--- + +Change the vite chunk filename hash to closely match our webpack syntax