-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Provide .mjs entry for native ESM #1217
Comments
I'm happy to entertain PRs that add this functionality to the build process. We already produce module files, which are used by rollup and other ES6 aware bundlers. Is all that necessary is changing file extension? |
* Writes .mjs instead of .js for code within ./module * Add a top level index.mjs file (which simply redirects to ./module) Fixes #1217
@jaydenseric I just put up a PR which seeks to support this case - would you might helping out with a test case? Even if you want to just pull down the PR and run the build to see if the resulting output solves things for you |
* Writes .mjs instead of .js for esmodules code. * Moves .mjs out of ./module into the top level since it no longer conflicts with .js Fixes #1217
* Writes .mjs instead of .js for esmodules code. * Moves .mjs out of ./module into the top level since it no longer conflicts with .js Fixes #1217
* Writes .mjs instead of .js for esmodules code. * Moves .mjs out of ./module into the top level since it no longer conflicts with .js Fixes #1217
This will make it possible for packages dependant on
graphql
to in turn do the same for their consumers, without encountering babel/babel#7294.Node.js with
--experimental-modules
can run ESM in .mjs files.Essentially, package.json needs to go from this:
To this:
Sibling
index.js
(CJS) andindex.mjs
(ESM) files need to be published. Node.js will load the relevant file, looking up.mjs
before.js
formain
if--experimental-modules
is enabled.The text was updated successfully, but these errors were encountered: