andywer / threads.js

🧵 Make web workers & worker threads as simple as a function call.
https://threads.js.org/
MIT License
3.06k stars 164 forks source link

Support spawning threads from electron ASAR file #425

Open hgossler opened 2 years ago

hgossler commented 2 years ago

In pull request 226 you added code that modifies paths containing the string .asar because worker files could only be used if they were not packaged in an ASAR file.

In the meantime, the electron team added support for working with workers bundled in ASAR files. However, the patch in 226 does not allow us to bundle worker scripts because the path is always rewritten to point to the unpacked directory.

Can we add an option to bypass any modifications to the scriptPath argument? Thank you for your time.

andywer commented 2 years ago

Great point and thanks for sharing!

You can prepare a PR if you've got some time for it. Maybe it makes sense to check if we are in an electron app and if so what version and disable the existing workaround if it's a new electron version with fixed ASAR support?