-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to spawn workers as a module #421
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request.
TBH, I am fine with switching to ESModule-only for the Worker implementation since all major browser has support of it, the ESModule adoption for Web Worker is pretty overdue at this point of time.
However, it is also good to have a non-breaking upgrade path so people are not forced to switch immediately.
Every major browser supports it so I don't see the need to keep the no-modules around. There is no user code that needs to be updated, as far as I'm aware, as all the JS is generated by wasm-bindgen and it calls WASM. |
2b207f1
to
44b25d5
Compare
I've changed the default to spawn the worker as a module (which means that this will be a breaking change), but I think it's worthwhile keeping the old behavior around for backwards compatibility reasons. |
This would allow creating workers with the `--target web` flag, alleviating the current missing features described [here](https://rustwasm.github.io/wasm-bindgen/examples/without-a-bundler.html?highlight=no-modules#using-the-older---target-no-modules)
44b25d5
to
d263d22
Compare
Ready to merge now. Will be a breaking change regardless, since both the public API of spawner is changed as well as the default |
@hamza1311 or @futursolo if you have time :) |
This is ready to be merged @hamza1311 @futursolo |
I really need this PR. Any timeline when it will be available? |
@ranile any chance you could have a look at merging this? Hopefully there aren't any conflicts in the meantime |
Workers created with the
--target web
flag must be spawned as a module. This adds the option to do that, alleviating the current--target no-modules
missing features described here. I will create a linked PR in trunk to add an option to create workers with this flag.