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
This commit is contained in:
DJ Mountney
2024-01-15 09:47:09 -08:00
committed by GitHub
parent f33bce41ea
commit a8b42bcd50
3 changed files with 13 additions and 3 deletions

View File

@@ -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:

View File

@@ -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',
},
},
},

View File

@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [twk3]
---
Change the vite chunk filename hash to closely match our webpack syntax