Build: use .mjs extensions for build-module files#74348
Conversation
|
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. |
|
Size Change: 0 B Total Size: 3.08 MB ℹ️ View Unchanged
|
|
@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.
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.
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.