Open
Description
What problem does this feature solve?
Hello! Opening this issue for #3240 (comment)
Context
https://rsbuild.dev/config/output/inline-scripts#async-chunks says that dynamicImportMode: 'eager'
should not generate async chunks anymore, however when importing workers like
const worker = new Worker(new URL('test.worker.ts', import.meta.url))
worker.postMessage('hello')
worker.onmessage = (e) => {
console.log(e.data)
}
It still produces an HTML file and a single async chunk which is the worker.
Unfortunately I'm not good with understanding webpack options, but I also tried configuring loader like that (which also didn't work unfortunately)
rspack: {
resolveLoader: {
alias: {
'worker-loader': require.resolve('worker-rspack-loader')
},
},
module: {
rules: [
{
test: /\.worker\.{js,ts}$/,
loader: 'worker-rspack-loader',
options: { inline: 'no-fallback' }
}
],
},
}
What does the proposed API look like?
I think web workers should be inlined when dynamicImportMode = eager
Context: FYI in my case half of workers are generated by esbuild (yes I'm using npm-run-all) and I inline them manually, but now I'm in transition to rebuild and AFAIS it still doesn't support it. Thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels