No support for web worker when using Typescript and Webpack 5?
See original GitHub issueDescribe the bug
Webpack 5 has deprecated ‘worker-loader’
When using the suggested webpack 5 compat loader API such as
const worker = new Worker(new URL('./test.worker.ts', import.meta.url));
worker.postMessage("test");
The CRA loaders @pmmmwh/react-refresh-webpack-plugin and babel-loader fails, and instead it returns with error
‘You may need an additional loader to handle the result of these loaders.’
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:8
Top Results From Across the Web
Web Workers written in Typescript in Webpack 5: SyntaxError
Webpack 5 documentation mentions that worker-loader is not needed anymore, and it seems easy for javascript files. However, I am using ...
Read more >Web Workers | webpack - JS.ORG
Web Workers. As of webpack 5, you can use Web Workers without worker-loader . ... Worker in CommonJS syntax is not supported by...
Read more >Loading web workers using Webpack 5 · mmazzarolo.com
As of today, there's not much documentation around webpack 5's web worker supports. It indeed works pretty well for the most common use-cases ......
Read more >How to bundle WebWorker coded with TypeScript in npm ...
To use Web Workers in webpack 5, ... (The worker-loader is deprecated in webpack5, but I've decided that it's not an option for...
Read more >Web workers, React, and TypeScript - LogRocket Blog
Web workers are a means for web browsers to run scripts in the background without interfering with the UI. If set up correctly,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thanks for noting this @ninichki I did not try using the test suite but I also get the same error. This may be related to jest and esm module support, not sure what the fix is though
I found that I could use a web worker with webpack 5 and create-react-app v5 with the deep thought example here https://webpack.js.org/guides/web-workers/
bare bones repo example https://github.com/cmdcolin/cra-webpack5-web-worker-example
@toeryn you mention using react-scripts 4 but this thread is about webpack 5