-
Notifications
You must be signed in to change notification settings - Fork 30k
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
esm: disable non-js exts outside package scopes #30501
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jkrems
approved these changes
Nov 15, 2019
//cc @nodejs/modules-active-members |
I'd like to suggest fast-tracking this if there are no objections. |
guybedford
added
the
fast-track
PRs that do not need to wait for 48 hours to land.
label
Nov 15, 2019
(Adding my 👍 to the comment above assuming it's a fast-track vote comment.) |
MylesBorins
approved these changes
Nov 15, 2019
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.
Would like a few more approvals before we land.
Lgtm
robpalme
approved these changes
Nov 15, 2019
/cc @nodejs/modules-active-members |
This comment has been minimized.
This comment has been minimized.
MylesBorins
pushed a commit
that referenced
this pull request
Nov 17, 2019
PR-URL: #30501 Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Myles Borins <[email protected]>
landed in 250a995 |
MylesBorins
pushed a commit
that referenced
this pull request
Nov 17, 2019
PR-URL: #30501 Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Myles Borins <[email protected]>
Merged
MylesBorins
pushed a commit
that referenced
this pull request
Jan 12, 2020
PR-URL: #30501 Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Myles Borins <[email protected]>
BethGriggs
pushed a commit
that referenced
this pull request
Feb 6, 2020
PR-URL: #30501 Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Myles Borins <[email protected]>
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Up until now the ES module resolver still supports loading
.json
and.node
files outside of ES module scopes (with"type": "module"
), mainly for backwards compatibility with the CJS resolver.This PR locks down that behaviour to ensure we are shipping the stricter semantics that don't permit users to just import JSON modules directly. The goal here is that if something like the module types proposal takes off, then we haven't already locked in ecosystem semantics that assume JSON imports.
The reason this is important is because right now the unflagged implementation will allow an
.mjs
file to import JSON, which once people start using will tend to make this a difficult thing to remove.If we get compatibility bugs, we can certainly relax this stance though, but our general approach to the implementation up until now has been to try to be conservative with the semantics to avoid wrong paths, which has so far served us well.
For the main entry into Node.js we have an explicit
isMain
check which will always support non-extensions for bin use cases and these types of files.The change is actually just the simple change at https://github.com/nodejs/node/pull/30501/files#diff-8e67f407bc32a0569e25d7ecaff6e494L1308, the rest is mostly just taking a chance to refactor the resolver logic a bit while retaining the same semantics.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes