Commit bd58870
esm: do not call
Ensure that `defaultLoad` does not uselessly access the file system to
get the source of modules that are known to be in CommonJS format.
This allows CommonJS imports to resolve in the current phase of the
event loop.
Refs: eslint/eslint#17683
PR-URL: #50465
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>getSource when format is commonjs
1 parent 087cffc commit bd58870Copy full SHA for bd58870
File tree
Expand file treeCollapse file tree
6 files changed
+69
-9
lines changedOpen diff view settings
Filter options
- lib/internal/modules/esm
- test
- es-module
- fixtures
- es-module-loaders
Expand file treeCollapse file tree
6 files changed
+69
-9
lines changedOpen diff view settings
Collapse file
lib/internal/modules/esm/load.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/load.js+10-9Lines changed: 10 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
132 | 132 | |
133 | 133 | |
134 | 134 | |
135 | | - |
136 | | - |
| 135 | + |
137 | 136 | |
138 | 137 | |
139 | | - |
| 138 | + |
140 | 139 | |
141 | 140 | |
142 | | - |
143 | | - |
| 141 | + |
| 142 | + |
| 143 | + |
144 | 144 | |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
149 | 150 | |
150 | 151 | |
151 | 152 | |
|
Collapse file
test/es-module/test-esm-dynamic-import-commonjs.js
Copy file name to clipboard+19Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
Collapse file
test/es-module/test-esm-dynamic-import-commonjs.mjs
Copy file name to clipboard+9Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
Collapse file
test/es-module/test-esm-loader-with-source.mjs
Copy file name to clipboard+10Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
Collapse file
Whitespace-only changes.
Collapse file
test/fixtures/es-module-loaders/preset-cjs-source.mjs
Copy file name to clipboard+21Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
0 commit comments