threads.js icon indicating copy to clipboard operation
threads.js copied to clipboard

Unexpected Token

Open ttessarolo opened this issue 2 years ago • 4 comments

To avoid Unexpected Token Error, just use:

 const worker = await spawn(new Worker(new URL("./worker.js", import.meta.url)));

instead of:

const worker = await spawn(new Worker("./worker.js"))

ttessarolo avatar Mar 31 '22 16:03 ttessarolo

Thanks for sharing, @ttessarolo!

We should document that somewhere… Feel free to propose a PR.

andywer avatar Apr 01 '22 19:04 andywer

@andywer remote: Permission to andywer/threads.js.git denied ;)

ttessarolo avatar Apr 02 '22 09:04 ttessarolo

Fork on github, make changes on your fork, make pull request from your fork to here :)

trasherdk avatar Apr 03 '22 02:04 trasherdk

Thanks for sharing, @ttessarolo!

We should document that somewhere… Feel free to propose a PR.

I'm using typescript and it says new Worker only gets string: Argument of type 'URL' is not assignable to parameter of type 'string'

rghaemifar avatar Feb 26 '23 12:02 rghaemifar