-
-
Notifications
You must be signed in to change notification settings - Fork 923
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
re-add esm bundle, and switch extension to module.js
instead of mjs
#2420
Comments
Could you find some relevant discussion on Preact's side? Also, I consider this a subbug of #1886, not a strict duplicate. |
@isiahmeadows There doesn't seem to be a huge amount of discussion specifically about switching from mjs to js. but quite a bit around the issues pre switching. Here are few comments/isses that mention the switch: I also checked their slack, but wasn't able to find many references to this topic there. |
Okay, it appears they've been pointing people to this Webpack plugin as a workaround, and we apparently weren't the only ones running into inconsistent module resolution logic with Webpack. (We may have just ran into a different variant of the same greater problem.) I'm open to this, and feel free to send a PR. Here's generally what I'm thinking:
|
Sound good! 👍 |
Make sure to include a "module:" property in package.json so that unpkg, pika and other CDNs can serve the module easily. |
Closing due to age. |
Description
In mithril 2.0.0-rc.5 the ESM bundle was removed (#2366). This was done mainly because of issues with webpack that caused confusion among users. Webpack would use the
mjs
file instead of thejs
file and not expose the default export in the standard way.preact had a similar issue because they also provided an
mjs
version of their bundle on npm. In their 10.0 beta they resolved this issue by changing the file extension tomodule.js
which does not cause issues with webpack.Why
Considering that most competing frameworks/libraries offer such a bundle, new users are likely to expect it, and even though using a script tag continues to work fine it's nice to have the option to use native modules when writing an app without a build process.
Other frameworks' bundle:
Possible Implementation & Open Questions
This is the commit that fixed the issue for preact. I propose we follow suit, and just change the extension to
module.js
.preactjs/preact@8ea29b5
Do we want to continue to use our custom scripts to generate the esm build?
Are we ready for rollup or something similar? (maybe too much change at this point) #1886
Is this something you're interested in working on?
Yes
The text was updated successfully, but these errors were encountered: