File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const WORKERS: Record<string, string> = {
4040
4141export default defineConfig ( [
4242 workersNodejs ( ) ,
43- workersBrowser ( ) ,
43+ ... workersBrowser ( ) ,
4444 nodejs ( ) ,
4545 nodejsTypes ( ) ,
4646 browser ( ) ,
@@ -250,18 +250,17 @@ function workersNodejs(): RollupOptions {
250250
251251/**
252252 * All worker bundles for browser - ESM format for use with web-worker {type: 'module'}
253+ * Each worker is built as a self-contained bundle with all dependencies inlined.
254+ * This avoids issues with webpack/karma not copying associated chunk files.
253255 */
254- function workersBrowser ( ) : RollupOptions {
255- return {
256- input : Object . fromEntries (
257- Object . entries ( WORKERS ) . map ( ( [ name , path ] ) => [ name , `./dist/browser/src/${ path } .js` ] )
258- ) ,
256+ function workersBrowser ( ) : RollupOptions [ ] {
257+ return Object . entries ( WORKERS ) . map ( ( [ name , path ] ) => ( {
258+ input : `./dist/browser/src/${ path } .js` ,
259259 context : 'self' ,
260260 output : {
261261 format : 'es' ,
262- dir : './dist/workers' ,
263- entryFileNames : '[name].browser.mjs' ,
264- chunkFileNames : '[name]-[hash].browser.mjs' ,
262+ file : `./dist/workers/${ name } .browser.mjs` ,
263+ inlineDynamicImports : true ,
265264 sourcemap : true ,
266265 } ,
267266 plugins : [
@@ -277,5 +276,5 @@ function workersBrowser(): RollupOptions {
277276 ] ,
278277 external : [ ] ,
279278 onwarn,
280- }
279+ } ) )
281280}
You can’t perform that action at this time.
0 commit comments