Skip to content

Commit

Permalink
perf: shorten asset file names
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Nov 15, 2024
1 parent 435984b commit ff34d60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-foxes-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

perf: shorten asset file names
4 changes: 2 additions & 2 deletions packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/apps/basics/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
}
});
});
Expand Down

0 comments on commit ff34d60

Please sign in to comment.