GoogleChromeLabs / worker-plugin

👩‍🏭 Adds native Web Worker bundling support to Webpack.
https://npm.im/worker-plugin
Apache License 2.0
1.91k stars 79 forks source link

vue use work-plugin. Error #90

Closed cwwjsyc closed 3 years ago

cwwjsyc commented 3 years ago

in xxx.work.js has some code like:

(async function Loop() {
    self.setInterval(async () => {
        let data = 'abcdefg';
        postMessage(data);
    }, 3000)
})()

and then. error on console. when compile like:

    6:47  error  'regeneratorRuntime' is not defined         no-undef
   7:12  error  'regeneratorRuntime' is not defined         no-undef
   8:14  error  Unexpected constant condition               no-constant-condition
  11:76  error  'regeneratorRuntime' is not defined         no-undef
  13:22  error  'regeneratorRuntime' is not defined         no-undef
  14:24  error  Unexpected constant condition               no-constant-condition
  20:21  error  Expected a 'break' statement before 'case'  no-fallthrough
  28:11  error  Expected a 'break' statement before 'case'  no-fallthrough

but without Method 'setInterval' ,it can works.

cwwjsyc commented 3 years ago

Add code comment on the file of worker.js. like ` / eslint-disable */`

IT works.!

cwwjsyc commented 3 years ago

Thanks , it was really working.

kamaladenalhomsi commented 3 years ago

the same issue for me, any help please?

kamaladenalhomsi commented 3 years ago

You can notice that the injected code is above the / eslint-disable / so I guess that's why it's not working

image

mima3 commented 3 years ago

I created an .eslintignore file to work around this issue.