-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Build: use .mjs extensions for build-module files #74348
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
Conversation
e948281 to
3ec5cdd
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
6651f24 to
cca1e06
Compare
|
Size Change: 0 B Total Size: 3.08 MB ℹ️ View Unchanged
|
cca1e06 to
86a02be
Compare
daa5a72 to
182eeee
Compare
|
@manzoorwanijk @aduth @youknowriad This is now ready as a followup to #73822. It should fix the issues that Jetpack encounters when trying to use the I had to give up on Instead, the published files in After some additional fixes here and there, renaming a few files (mostly stylelint) from One major package I found that uses this convention is stylelint. No |
manzoorwanijk
left a comment
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.
This makes more sense, and I agree that the explicit extension regardless of the type field in the package.json makes it more reliable, robust, and portable.
* Build: output .mjs extensions for ESM build * ESLint resolver: map .mjs files to .js source * Theme: add .mjs extensions to generated files and stylelint plugins * Components: rename stylelintrc to .mjs * package.json files: remove type:module, .mjs exports * Add changelog entries
Attempt to fix the CJS build issues described in #73822 (comment). The plan is to:
type: modulefrompackage.jsonfiles, because that enables strict Node.js compat in esbuild (Double wrapping when converting esm to cjs evanw/esbuild#2623) which makes it practically impossible to usedefaultexports while producing CJS versions of packages.type: moduleuse the.mjsextension for all ESM files. The idea is that we don't use.jsextensions, for whichtype: moduleprovides the default format, but we always specify the module format explicitly, with the.cjsor.mjsextension.Let's see what CI checks think about this.