Skip to content

Conversation

timokoessler
Copy link

This PR prevents that the load hook returns a nullish value for the source if a CJS module is loaded.
The reason for this is that Node.js will otherwise crash if the synchronous module customization hooks are used. See nodejs/node#57327 for more information. The Node.js documentation also mentions that returning nullish values might no longer be supported in the future in general.

jsumners-nr
jsumners-nr previously approved these changes Jun 26, 2025
Co-authored-by: James Sumners <[email protected]>
@timfish
Copy link
Contributor

timfish commented Jun 26, 2025

Happy to consider merging this if we can get the CI tests passing!

@timokoessler
Copy link
Author

Unfortunately, this fix appears to cause problems with the module cache in Node.js in some cases. I have added a comment to the issue: nodejs/node#57327 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants