Currently there are two issues when using web workers related code in the Vue Skeleton:
"allowJs": true, in the tsconfig.json will make TS try to understand webworkers that are going through webpack and being changed, but TS will fail and say it's not a module (which it indeed isn't).
Hot Reloading config will add a window reference in the webpack header of the worker file, which breaks in a web worker.
Current workarounds:
Add a // @ts-ignore comment above the worker imports
Add globalObject: 'this', to the output section of the webpack config.
For point 1 we cannot do much I think, people should just remember to do that.
For point 2 we could make an update to the skeleton to set it as a default.
Currently there are two issues when using web workers related code in the Vue Skeleton:
"allowJs": true,
in thetsconfig.json
will make TS try to understand webworkers that are going through webpack and being changed, but TS will fail and say it's not a module (which it indeed isn't).window
reference in the webpack header of the worker file, which breaks in a web worker.Current workarounds:
// @ts-ignore
comment above the worker importsglobalObject: 'this',
to theoutput
section of the webpack config.For point 1 we cannot do much I think, people should just remember to do that. For point 2 we could make an update to the skeleton to set it as a default.