hjeti / vue-skeleton

A Vue skeleton
MIT License
108 stars 21 forks source link

worker-loader compatibility #91

Closed ThaNarie closed 5 years ago

ThaNarie commented 5 years ago

Currently there are two issues when using web workers related code in the Vue Skeleton:

  1. "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).
  2. Hot Reloading config will add a window reference in the webpack header of the worker file, which breaks in a web worker.

Current workarounds:

  1. Add a // @ts-ignore comment above the worker imports
  2. 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.