Deprecate `--target no-modules`
ES modules are the official, standardized way to structure JS code, supported by all currently used browsers and node and deno. The guide already mentions that no-modules is older and has some caveats. It does not explain any advantages of --no-modules. I know one reason for it: Firefox didn't support ES module web workers until the current version 111. ~~This is fixed now.~~ It's still behind a flag. Is there any other case where --target no-modules is needed?
If no-modules is deprecated, it should be removed in the next breaking change version (which is in the far future probably), but it also would add justification for primarily supporting ES modules in new features (like #3247 and #3034) to avoid additional effort (without breaking existing code, of course).
I know one reason for it: Firefox didn't support ES module web workers until the current version 111. This is fixed now.
No, it's not. It's been implemented, but it's still behind a flag.
Once Firefox does support module workers, though, I think I'd be in favour of this. It would be kind of nice to be free of the baggage of no-modules.
@alexcrichton, do you have any thoughts on this?
I'm in favor when Firefox actually stabilizes this and after that for a little bit until everybody updates.
Relevant issues
Being put behind a flag: https://bugzilla.mozilla.org/show_bug.cgi?id=1812628 Tracking issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1812591
Seems reasonable to me to consider it deprecated!
Worker modules are currently slated to be stable in Firefox 114.
See the release notes and the bugzilla tracking issue.
Is there any other case where
--target no-modulesis needed?
Web workers. Workers are built with no-modules and loaded in new Worker(...) (such as with gloo-worker).
CC: @futursolo (as they implemented the gloo-worker crate)
Please no. You can't make extensions or service workers without this
Indeed, until all browsers, in this case Firefox (Bugzilla), support module workers in every context, this will have to wait.
Extensions don't support ES modules?