diff --git a/scripts/build-atomics.ts b/scripts/build-atomics.ts index 57aa5451..4052dc9e 100644 --- a/scripts/build-atomics.ts +++ b/scripts/build-atomics.ts @@ -35,9 +35,8 @@ function buildAtomicsDebug(opts: BuildOptions): RollupOptions { for (const f in bundle) { const b = bundle[f]; if (b.type === 'chunk') { - const jsCode = b.code; const debugJsPath = join(opts.distLibDebugDir, 'partytown-sandbox-atomics.js'); - await writeFile(debugJsPath, jsCode); + await writeFile(debugJsPath, b.code); b.code = debugHtml; } } diff --git a/scripts/build-web-worker.ts b/scripts/build-web-worker.ts index 19801dac..2da468b2 100644 --- a/scripts/build-web-worker.ts +++ b/scripts/build-web-worker.ts @@ -58,5 +58,12 @@ export function webWorkerBlobUrlPlugin( } return null; }, + async generateBundle() { + if (opts.isDev) { + const wwCode = await buildWebWorker(opts, msgType, debug); + const wwDebugFilePath = join(opts.distLibDebugDir, `partytown-ww-${msgType}.js`); + await writeFile(wwDebugFilePath, wwCode); + } + }, }; }