Forward whole context to ESM hooks #1572
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ensure that all properties of the context objects passed to the
resolve
andload
ESM hooks are forwarded to the default hooks.This change is necessary to for using import assertions in Node v17. Node v17 requires these import assertions for JSON modules. If the assertions are not passed down to the default
load
function, Node refuses to import the JSON module.To prevent similar issues we also forward the context for the
resolve
hook.I’d love to add some tests for this but I’d need some help as to how to approach
this.