Replies: 5 comments 40 replies
-
https://www.typescriptlang.org/play?#code/HYUw7gBA6g9gTgaxHAFKSBVASgGRQcgDoB6MeJOQgKwGd8AaCASwFsAHeAF0JZE4ENCAVzgAbAJTiA3EA, what is the problem? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hey guys there seems to be an issue in my situation. So I have a project which I bundle for use in a React project. When I try to use
It compiles fine with just the compiled js contents of the typescript worker file. However neither work and they both cause an Both React App and project use webpack 5. The project webpack config:
|
Beta Was this translation helpful? Give feedback.
-
I think HMR will conflict with this. then I will get But in fact Promise can be used in web worker with modern browsers and I have tested that the async can use in my browser. |
Beta Was this translation helpful? Give feedback.
-
I have spent more tha a day trying to make this work with electron, typescript, commonjs (no import.meta.url) and webpack 5 way. Been through so many hacks suggested by copilot and my own humble intelligence:-), but none really worked! |
Beta Was this translation helpful? Give feedback.
-
Hi,
The documentation for webpack 5 says that webpack no longer needs
worker-loader
to load web worker files.This is reinforced by the README on the
worker-loader
page, which warns thatworker-loader
is only intended for use with webpack 4 and is not supposed to be used with webpack 5.However, the example of worker usage in the webpack docs is very simple — it assumes that developers author their worker files in javascript. How should one configure webpack to be able to load workers authored in typescript?
Beta Was this translation helpful? Give feedback.
All reactions