-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
V7 #241
V7 #241
Conversation
Add Node 14 to CI.
Co-authored-by: Ricky Patel <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #241 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 227 227
Branches 46 46
=========================================
Hits 227 227
Continue to review full report at Codecov.
|
I think a lot of people are going to disagree with this. Developers want consistency, and that means using one module system within a project. ES2015 has gained massive adoption, and modules have been widely supported in browsers for a number of years. Node.js may have lagged behind a bit, but they've removed the flag and enabled it by default, regardless of its official stability designation. It's pretty clear that the future for Javascript modules is ESM, not CommonJS. Many projects write all the code they can as ES modules, only to have a few config files that are simple wrappers around So given a future where ESM is a guarantee, and where CommonJS usage will gradually disappear, we're going to have to pull the plug on the synchronous API eventually. I think it's prudent to start discouraging its use now, to lessen the impact of deprecating it in the future. |
@vvanpo Unfortunately, I suspect that plenty of users would not be happy about pulling the plug on the synchronous API. (I'd love to hear that this opinion has changed.) That seems to me the priority feature for a couple of reasons: (a) it already exists; (b) it is not possible (without nasty hacks) to extend the asynchronous API and make it synchronous, while it is very, very possible to implement an That said, I realize that in my eagerness to use the native |
@davidtheclark Unfortunately that project doesn't appear to be maintained (last commit was almost a year ago). I tried playing around with it, and immediately ran into a major bug. Even if it was working, using it would enable some behaviours that could never be replicated using native ESM in Node.js (synchronous imports of ES modules, as well as detecting CJS vs. ESM based on file contents, not the package's
Of course, and I would never suggest dropping support for it while it still has lots of users. But if we allow the two APIs to diverge slightly by supporting ESM in the asynchronous API, I believe usage of the synchronous API will eventually drop off enough that it can be deprecated. Even if supporting Although I've never worked on |
}, | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" |
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.
Since support for node@8
was dropped, should the @babel/preset-env
targets be updated to { node: '10' }
as well?
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.
Yes, good find.
Thanks for the warnings about esm. I'm definitely open to a PR by someone invested in the feature 👍 |
Thanks! |
I will release v7 today, instead of holding back any longer for |
Changelog entry:
${moduleName}rc.cjs
and${moduleName}.config.cjs
to the defaultsearchPlaces
, to support users of"type": "module"
in recent versions of Node.After looking a little bit into
.mjs
support, I'm not inclined to add it to the defaultsearchPlaces
& loaders, for a few reasons:searchPlaces
would vary betweencosmiconfig
andcosmiconfigSync
, which would be confusing and annoying..mjs
not only wouldn't work withcosmiconfigSync
: it also wouldn't work with some versions of Node that Cosmiconfig supports.import
andexport
keywords, especially since support is still consideredStability 1: Experimental
even in Node 14.I'll let this PR sit for a couple of days to see if anybody has any feedback, or wants to show a good way to add
.mjs
support.