From 8f07cbe9da6a584d460798c78954a3b3d2e03f40 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 16 Sep 2023 10:27:39 +0200 Subject: [PATCH] fix(lib): Include hash in assets name When using css inlining and multiple output formats (e.g. esm and cjs) the assets order is not deterministic. This causes issues if the assets are named the same, e.g. if you have multiple "index" entry points the assets will be called index1, index2... So when not using hashes the last output format might override the assets with a changed order, causing the previous output formats to be invalid. Signed-off-by: Ferdinand Thiessen --- lib/libConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libConfig.ts b/lib/libConfig.ts index b09bbf1..23999be 100644 --- a/lib/libConfig.ts +++ b/lib/libConfig.ts @@ -92,7 +92,7 @@ export const createLibConfig = (entries: { [entryAlias: string]: string }, optio if (!options.inlineCSS && /css/i.test(extType)) { return '[name].css' } - return 'assets/[name][extname]' + return 'assets/[name]-[hash][extname]' } // Manually define output options for file extensions