Skip to content

esm: fix hint on invalid module specifier - #51223

Merged
nodejs-github-bot merged 7 commits into
nodejs:mainfrom
aduh95:fix-invalid-hint
Dec 23, 2023
Merged

esm: fix hint on invalid module specifier#51223
nodejs-github-bot merged 7 commits into
nodejs:mainfrom
aduh95:fix-invalid-hint

Conversation

@aduh95

Copy link
Copy Markdown
Contributor

URLs are hard to work with.

Fixes: #51216

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-botnodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Dec 19, 2023
Comment threadtest/es-module/test-esm-module-not-found-commonjs-hint.mjs Outdated
Comment threadtest/es-module/test-esm-module-not-found-commonjs-hint.mjs Outdated
Comment threadlib/internal/modules/esm/resolve.js Outdated
Comment threadlib/internal/modules/esm/resolve.js Outdated
Comment threadlib/internal/modules/esm/resolve.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This might be a little bit more readable.

Suggested change
found=`${pathToFileURL(found)}`;
found=pathToFileURL(found).href;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we try to always "coerce to string" in core rather than calling the .href getter, that way if the prototype gets tampered with, all of core is affected consistently.

Comment threadlib/internal/modules/esm/resolve.js Outdated
Comment threadlib/internal/modules/esm/resolve.js Outdated
Comment threadlib/internal/modules/esm/resolve.js Outdated
fix for Windows (`?` is illegal in file names apparently)
@aduh95aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 21, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 21, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/internal/modules/esm/resolve.js Outdated
Comment threadlib/internal/modules/esm/resolve.js Outdated
@aduh95aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 23, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 23, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 23, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 23, 2023
@nodejs-github-bot
nodejs-github-bot merged commit a717fa2 into nodejs:mainDec 23, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in a717fa2

@aduh95
aduh95 deleted the fix-invalid-hint branch December 23, 2023 23:34
RafaelGSS pushed a commit that referenced this pull request Jan 2, 2024
PR-URL: #51223Fixes: #51216
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@RafaelGSSRafaelGSS mentioned this pull request Jan 2, 2024
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #51223Fixes: #51216
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@richardlaurichardlau mentioned this pull request Mar 25, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.esmIssues and PRs related to the ECMAScript Modules implementation.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

module import errors follow different logic than importing

6 participants

@aduh95@nodejs-github-bot@jasnell@GeoffreyBooth@guybedford@anonrig