Commit e683077
module: fix hook module CJS dependency loading
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>1 parent b1e2a38 commit e683077Copy full SHA for e683077
File tree
Expand file treeCollapse file tree
4 files changed
+15
-1
lines changedOpen diff view settings
Filter options
- lib
- test
- es-module
- fixtures/es-module-loaders
Expand file treeCollapse file tree
4 files changed
+15
-1
lines changedOpen diff view settings
Collapse file
+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
447 | 447 | |
448 | 448 | |
449 | 449 | |
450 | | - |
| 450 | + |
| 451 | + |
451 | 452 | |
452 | 453 | |
453 | 454 | |
|
Collapse file
test/es-module/test-esm-loader-dependency.mjs
Copy file name to clipboard+5Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
Collapse file
test/fixtures/es-module-loaders/loader-dep.js
Copy file name to clipboard+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
Collapse file
test/fixtures/es-module-loaders/loader-with-dep.mjs
Copy file name to clipboard+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
0 commit comments