-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: fix loader hooks accepting too many arguments
PR-URL: #44109 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
- Loading branch information
1 parent
e7d101f
commit 5e9c197
Showing
4 changed files
with
64 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export async function resolve(...args) { | ||
console.log(`resolve arg count: ${args.length}`); | ||
console.log({ | ||
specifier: args[0], | ||
context: args[1], | ||
next: args[2], | ||
}); | ||
|
||
return { | ||
shortCircuit: true, | ||
url: args[0], | ||
}; | ||
} | ||
|
||
export async function load(...args) { | ||
console.log(`load arg count: ${args.length}`); | ||
console.log({ | ||
url: args[0], | ||
context: args[1], | ||
next: args[2], | ||
}); | ||
|
||
return { | ||
format: 'module', | ||
source: '', | ||
shortCircuit: true, | ||
}; | ||
} |
7 changes: 7 additions & 0 deletions
7
test/fixtures/es-module-loaders/loader-with-too-many-args.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,7 @@ | ||
export async function resolve(specifier, context, next) { | ||
return next(specifier, context, 'resolve-extra-arg'); | ||
} | ||
|
||
export async function load(url, context, next) { | ||
return next(url, context, 'load-extra-arg'); | ||
} |