forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
164 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
14 changes: 14 additions & 0 deletions
14
test/fixtures/es-module-loaders/loader-load-dynamic-import.mjs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { writeSync } from 'node:fs'; | ||
|
||
|
||
export async function load(url, context, next) { | ||
if (url === 'node:fs' || url.includes('loader')) { | ||
return next(url); | ||
} | ||
|
||
// Here for asserting dynamic import | ||
await import('xxx/loader-load-passthru.mjs'); | ||
|
||
writeSync(1, 'load dynamic import' + '\n'); // Signal that this specific hook ran | ||
return next(url, context); | ||
} |
14 changes: 14 additions & 0 deletions
14
test/fixtures/es-module-loaders/loader-resolve-dynamic-import.mjs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { writeSync } from 'node:fs'; | ||
|
||
|
||
export async function resolve(specifier, context, next) { | ||
if (specifier === 'node:fs' || specifier.includes('loader')) { | ||
return next(specifier); | ||
} | ||
|
||
// Here for asserting dynamic import | ||
await import('xxx/loader-resolve-passthru.mjs'); | ||
|
||
writeSync(1, 'resolve dynamic import' + '\n'); // Signal that this specific hook ran | ||
return next(specifier); | ||
} |