Skip to content

lib: add warning on dynamic import es modules - #30720

Closed
juanarbol wants to merge 3 commits into
nodejs:masterfrom
juanarbol:warning-es-dynamic-import
Closed

lib: add warning on dynamic import es modules#30720
juanarbol wants to merge 3 commits into
nodejs:masterfrom
juanarbol:warning-es-dynamic-import

Conversation

@juanarbol

@juanarboljuanarbol commented Nov 29, 2019

Copy link
Copy Markdown
Member

Fixes#30601.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the process Issues and PRs related to the process subsystem. label Nov 29, 2019
@juanarbol

Copy link
Copy Markdown
MemberAuthor

Ref: #30601

@cjihrig

Copy link
Copy Markdown
Contributor

Can you add a test please.

@juanarbol

Copy link
Copy Markdown
MemberAuthor

Sure, should I use a child process and test std err, or is there another way?

@cjihrig

Copy link
Copy Markdown
Contributor

We have common.expectWarning() in our tests. You should be able to look in the test/ directory for examples.

@juanarbol

Copy link
Copy Markdown
MemberAuthor

As long as code is undefined, common.expectWarning throws me an exception. So I used assertions instead of expectWarning

const [ message, code ] = expected.shift(); ^TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

Comment threadlib/internal/process/esm_loader.js Outdated
@juanarbol

Copy link
Copy Markdown
MemberAuthor

@guybedford Done! Thanks for reviewing! Tell me if something else is not correct.

@guybedfordguybedford added the esm Issues and PRs related to the ECMAScript Modules implementation. label Dec 7, 2019

@guybedfordguybedford left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@guybedfordguybedford added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 7, 2019
guybedford pushed a commit that referenced this pull request Dec 7, 2019
PR-URL: #30720
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@guybedford

Copy link
Copy Markdown
Contributor

Landed in 6669cd1.

targos pushed a commit that referenced this pull request Dec 9, 2019
PR-URL: #30720
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Dec 13, 2019
@targos

Copy link
Copy Markdown
Member

Depends on #29866 to land on v12.x-staging

targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
PR-URL: nodejs#30720
Reviewed-By: Guy Bedford <guybedford@gmail.com>
targos pushed a commit to targos/node that referenced this pull request May 7, 2020
PR-URL: nodejs#30720
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@targostargos added backported-to-v12.x and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backport-open-v12.x labels May 7, 2020
targos pushed a commit that referenced this pull request May 7, 2020
PR-URL: #30720
Backport-PR-URL: #33055
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@targostargos mentioned this pull request May 7, 2020
targos pushed a commit that referenced this pull request May 13, 2020
PR-URL: #30720
Backport-PR-URL: #33055
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@juanarbol
juanarbol deleted the warning-es-dynamic-import branch January 19, 2021 16:38
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

esmIssues and PRs related to the ECMAScript Modules implementation.processIssues and PRs related to the process subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Experimental modules warning does not show when using dynamic import

5 participants

@juanarbol@cjihrig@nodejs-github-bot@guybedford@targos