FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

module: Fix bug for undefined CJS dependency loading from loader hook file by guybedford · Pull Request #16381 · nodejs/node · GitHub

/ node Public

module: Fix bug for undefined CJS dependency loading from loader hook file - #16381

Closed
guybedford wants to merge 1 commit into
nodejs:masterfrom
guybedford:hook-dependency-bug-fix
Closed

module: Fix bug for undefined CJS dependency loading from loader hook file#16381
guybedford wants to merge 1 commit into
nodejs:masterfrom
guybedford:hook-dependency-bug-fix

Conversation

guybedford commented Oct 22, 2017
edited
Loading

Copy link
Copy Markdown
Contributor

It can be useful to load dependencies as part of the loader hook definition file. This fixes a bug where import x from 'x' would always return x as undefined if the import was made in a loader hooks definition module.

A parallel change to the CJS loading injection process which happens in https://github.com/nodejs/node/blob/master/lib/module.js#L521 meant that the CJS module wasn't being injected into the correct loader instance, which is corrected here with a test.

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

esmodules

nodejs-github-bot added the module Issues and PRs related to the module subsystem. label Oct 22, 2017

Copy link
Copy Markdown
Contributor Author

Would it be possible to get a CI run here?

targos commented Oct 24, 2017

Copy link
Copy Markdown
Member

CI is currently locked because of the security release

Copy link
Copy Markdown
Contributor Author

Thanks @targos, if that's clear now are we good to go?

targos commented Oct 25, 2017

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Contributor Author

Ok, looks like all are passing except for one failure which seems CI-system-related.

Copy link
Copy Markdown
Contributor Author

Would it be possible to merge this yet?

targos commented Oct 28, 2017

Copy link
Copy Markdown
Member

Landed in d853758. Thanks!

targos closed this Oct 28, 2017
targos pushed a commit that referenced this pull request Oct 28, 2017
It can be useful to load dependencies as part of the loader hook
definition file. This fixes a bug where `import x from 'x'` would
always return `x` as `undefined` if the import was made in a loader
hooks definition module.

A parallel change to the CJS loading injection process meant that the
CJS module wasn't being injected into the correct loader instance,
which is corrected here with a test.

PR-URL: #16381
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>

Copy link
Copy Markdown
Contributor Author

Thanks so much for the quick merge @targos.

gibfahn pushed a commit that referenced this pull request Oct 30, 2017
It can be useful to load dependencies as part of the loader hook
definition file. This fixes a bug where `import x from 'x'` would
always return `x` as `undefined` if the import was made in a loader
hooks definition module.

A parallel change to the CJS loading injection process meant that the
CJS module wasn't being injected into the correct loader instance,
which is corrected here with a test.

PR-URL: #16381
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
It can be useful to load dependencies as part of the loader hook
definition file. This fixes a bug where `import x from 'x'` would
always return `x` as `undefined` if the import was made in a loader
hooks definition module.

A parallel change to the CJS loading injection process meant that the
CJS module wasn't being injected into the correct loader instance,
which is corrected here with a test.

PR-URL: #16381
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
It can be useful to load dependencies as part of the loader hook
definition file. This fixes a bug where `import x from 'x'` would
always return `x` as `undefined` if the import was made in a loader
hooks definition module.

A parallel change to the CJS loading injection process meant that the
CJS module wasn't being injected into the correct loader instance,
which is corrected here with a test.

PR-URL: #16381
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
gibfahn mentioned this pull request Oct 31, 2017
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
It can be useful to load dependencies as part of the loader hook
definition file. This fixes a bug where `import x from 'x'` would
always return `x` as `undefined` if the import was made in a loader
hooks definition module.

A parallel change to the CJS loading injection process meant that the
CJS module wasn't being injected into the correct loader instance,
which is corrected here with a test.

PR-URL: nodejs/node#16381
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
It can be useful to load dependencies as part of the loader hook
definition file. This fixes a bug where `import x from 'x'` would
always return `x` as `undefined` if the import was made in a loader
hooks definition module.

A parallel change to the CJS loading injection process meant that the
CJS module wasn't being injected into the correct loader instance,
which is corrected here with a test.

PR-URL: nodejs/node#16381
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>

Copy link
Copy Markdown
Contributor

Assuming we shouldn't backport this to v6.x

Please lmk if I am mistaken

addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
It can be useful to load dependencies as part of the loader hook
definition file. This fixes a bug where `import x from 'x'` would
always return `x` as `undefined` if the import was made in a loader
hooks definition module.

A parallel change to the CJS loading injection process meant that the
CJS module wasn't being injected into the correct loader instance,
which is corrected here with a test.

PR-URL: nodejs/node#16381
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module Issues and PRs related to the module subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL