fix: harden worklet caching and build guard

Un-hashed libopenmpt.worklet.js was inheriting the immutable
1-year cache from /assets/, risking stale audio on chiptune3
bumps. Add a dedicated short-cache location for it.

Also fail closeBundle loudly if the worklet source vanishes,
instead of silently shipping a build with hanging audio.
This commit is contained in:
L'électron rare
2026-07-09 12:40:16 +02:00
parent 2287868d2a
commit 311cd58a6e
2 changed files with 12 additions and 1 deletions
+5 -1
View File
@@ -30,7 +30,11 @@ function chiptuneWorkletFix(): Plugin {
},
closeBundle() {
const src = resolve('node_modules/chiptune3/libopenmpt.worklet.js')
if (!existsSync(src)) return
if (!existsSync(src)) {
throw new Error(
'chiptuneWorkletFix: libopenmpt.worklet.js not found — chiptune3 layout changed?',
)
}
const dest = resolve(outDir, assetsDir, 'libopenmpt.worklet.js')
copyFileSync(src, dest)
},