Skip to content
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

module: no type module resolver changes #33086

Closed
wants to merge 1 commit into from

Conversation

guybedford
Copy link
Contributor

Previously a special case was implemented where "main" requires an explicit file extension when using "type": "module" in the ESM loader.

This was done before "exports" was a first-class main resolution mechanism.

With this change, "type": "module" will never affect resolution itself, only interpretation of the module format.

This change is backwards compatible, although care should be taken to backport it so that it doesn't result in surprising behaviour in older versions of Node.js if we miss eg 12 backports.

@nodejs/modules-active-members

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the esm Issues and PRs related to the ECMAScript Modules implementation. label Apr 27, 2020
@aduh95 aduh95 mentioned this pull request Apr 27, 2020
3 tasks
@guybedford guybedford changed the title module: no type: module resolve changes module: no type module resolver changes Apr 27, 2020
@ljharb
Copy link
Member

ljharb commented Apr 27, 2020

So this means that normal CJS-style resolution of "main" will apply to locate the file, and then the "type" kicks in when deciding how to evaluate it?

@guybedford
Copy link
Contributor Author

So this means that normal CJS-style resolution of "main" will apply to locate the file, and then the "type" kicks in when deciding how to evaluate it?

Yes, previously "type": "module" would force the main to be an exact file only.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Apr 29, 2020

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 29, 2020
guybedford added a commit that referenced this pull request Apr 30, 2020
PR-URL: #33086
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
@guybedford
Copy link
Contributor Author

Landed in 2496db8.

@guybedford guybedford closed this Apr 30, 2020
targos pushed a commit that referenced this pull request May 4, 2020
PR-URL: #33086
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
@targos targos mentioned this pull request May 4, 2020
targos pushed a commit that referenced this pull request May 7, 2020
PR-URL: #33086
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
targos pushed a commit that referenced this pull request May 13, 2020
PR-URL: #33086
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants