diff --git a/.changeset/blue-foxes-clean.md b/.changeset/blue-foxes-clean.md new file mode 100644 index 0000000000000..98abf5264cbd7 --- /dev/null +++ b/.changeset/blue-foxes-clean.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +perf: shorten asset file names diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js index e6521e9795607..39a613f25ccc6 100644 --- a/packages/kit/src/exports/vite/index.js +++ b/packages/kit/src/exports/vite/index.js @@ -641,7 +641,7 @@ async function kit({ svelte_config }) { format: 'esm', entryFileNames: ssr ? '[name].js' : `${prefix}/[name].[hash].${ext}`, chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[name].[hash].${ext}`, - assetFileNames: `${prefix}/assets/[name].[hash][extname]`, + assetFileNames: `${prefix}/assets/[hash][extname]`, hoistTransitiveImports: false, sourcemapIgnoreList }, @@ -656,7 +656,7 @@ async function kit({ svelte_config }) { output: { entryFileNames: `${prefix}/workers/[name]-[hash].js`, chunkFileNames: `${prefix}/workers/chunks/[name]-[hash].js`, - assetFileNames: `${prefix}/workers/assets/[name]-[hash][extname]`, + assetFileNames: `${prefix}/workers/assets/[hash][extname]`, hoistTransitiveImports: false } } diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js index fb21412290d63..5b568eeb53f9b 100644 --- a/packages/kit/test/apps/basics/test/test.js +++ b/packages/kit/test/apps/basics/test/test.js @@ -50,7 +50,7 @@ test.describe('Imports', () => { ]); } else { expect(sources[0].startsWith('data:image/png;base64,')).toBeTruthy(); - expect(sources[1]).toMatch(/\/_app\/immutable\/assets\/large\.[\w-]+\.jpg/); + expect(sources[1]).toMatch(/\/_app\/immutable\/assets\/[\w-]+\.jpg/); } }); });