Skip to content

repl: fix referrer for dynamic import - #30609

Closed
coreyfarrell wants to merge 1 commit into
nodejs:masterfrom
coreyfarrell:repl-dynamic-import
Closed

repl: fix referrer for dynamic import#30609
coreyfarrell wants to merge 1 commit into
nodejs:masterfrom
coreyfarrell:repl-dynamic-import

Conversation

@coreyfarrell

Copy link
Copy Markdown
Member

The ESM loader does not accept a directory as the referrer, it requires
a path within the directory. Add /repl to ensure relative dynamic
imports can succeed.

Fixes: #19570

Checklist

@nodejs-github-botnodejs-github-bot added the repl Issues and PRs related to the REPL subsystem. label Nov 23, 2019
Comment threadlib/repl.js Outdated
@devsnekdevsnek added the esm Issues and PRs related to the ECMAScript Modules implementation. label Nov 23, 2019

@devsnekdevsnek left a comment

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.

can you put in a comment explaining why the path is being modified?

@coreyfarrell

Copy link
Copy Markdown
MemberAuthor

@devsnek sure but to clarify are you asking for a comment about why /repl is being added or about why the test spawns using cwd in the fixtures (or both)?

@devsnek

Copy link
Copy Markdown
Member

I am talking about the /repl

@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 27, 2019
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

The ESM loader does not accept a directory as the referrer, it requires
a path within the directory. Add `/repl` to ensure relative dynamic
imports can succeed.
Fixes: nodejs#19570
@nodejs-github-bot

This comment has been minimized.

@bcoe
bcoe self-requested a review November 30, 2019 20:39
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@bcoe

bcoe commented Dec 1, 2019

Copy link
Copy Markdown
Contributor

Windows tests have been quite flaky today, but I don't believe it's related to this PR the most recent failure was test-worker-prof.js (which does not appear to involve the repl in any manner).

bcoe pushed a commit that referenced this pull request Dec 1, 2019
The ESM loader does not accept a directory as the referrer, it requires
a path within the directory. Add `/repl` to ensure relative dynamic
imports can succeed.
Fixes: #19570
PR-URL: #30609
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Coe <bencoe@gmail.com>
@bcoe

bcoe commented Dec 1, 2019

Copy link
Copy Markdown
Contributor

Landed in 49fb529

@bcoebcoe closed this Dec 1, 2019
@bcoe

bcoe commented Dec 1, 2019

Copy link
Copy Markdown
Contributor

Congrats on your contribution to the project @coreyfarrell; thanks for helping perfect the ESM functionality.

targos pushed a commit that referenced this pull request Dec 1, 2019
The ESM loader does not accept a directory as the referrer, it requires
a path within the directory. Add `/repl` to ensure relative dynamic
imports can succeed.
Fixes: #19570
PR-URL: #30609
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Coe <bencoe@gmail.com>
@coreyfarrell
coreyfarrell deleted the repl-dynamic-import branch December 1, 2019 16:40
@coreyfarrell

Copy link
Copy Markdown
MemberAuthor

A backport of this PR is needed for 12.x. I'm a little unclear from https://github.com/nodejs/node/blob/master/doc/guides/backporting-to-release-lines.md, should I wait 2 weeks before posting a PR against v12.x-staging or do I just post now and it gets blocked for 2 weeks?

@targos

Copy link
Copy Markdown
Member

@coreyfarrell This change doesn't apply cleanly to 12.x because we haven't unflagged ESM there yet. I think we should try to land things in order or it will be difficult to correctly backport everything related to ESM.

@coreyfarrell

Copy link
Copy Markdown
MemberAuthor

@targos I'm aware it doesn't apply cleanly, I've done the backport in a local branch. Are you saying that ESM will get unflagged in a future 12.x? Is a list being collected of ESM stuff that needs backport to 12.x?

@targos

Copy link
Copy Markdown
Member

There's no list only for ESM stuff, but many PRs related to ESM are semver-minor will have to wait at least for 12.14.0 in January 2020.

@BridgeARBridgeAR mentioned this pull request Dec 3, 2019
@MylesBorins

Copy link
Copy Markdown
Contributor

hey @coreyfarrell fyi I just backported this to 12.x in 2ccfcd3fab

MylesBorins pushed a commit that referenced this pull request Jan 12, 2020
The ESM loader does not accept a directory as the referrer, it requires
a path within the directory. Add `/repl` to ensure relative dynamic
imports can succeed.
Fixes: #19570
PR-URL: #30609
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Coe <bencoe@gmail.com>
@targostargos mentioned this pull request Jan 15, 2020
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
The ESM loader does not accept a directory as the referrer, it requires
a path within the directory. Add `/repl` to ensure relative dynamic
imports can succeed.
Fixes: #19570
PR-URL: #30609
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Coe <bencoe@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Feb 8, 2020
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.replIssues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dynamic import can't be used in the REPL

7 participants

@coreyfarrell@devsnek@nodejs-github-bot@bcoe@targos@MylesBorins@addaleax