-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esm: invalid extension error should provide parent context in error #30721
Comments
@nodejs/modules-active-members |
If you run this example with We should look at improving this error message to include the parent module that cause the load to provide debugging context. For that reason I'm changing the title and marking this as a bug. |
(@LJNeon I hope you don't mind me rewording your original issue to reflect the root cause, we can move it to another issue if you'd prefer too.) |
I'd like to give this a try. Would it be okay to modify default_resolve (the only place I see this error being used) so that |
- default_resolve updated to pass parentURL into error - ERR_UNKNOWN_FILE_EXTENSION updated to include parentURL - test added to check for import message in error PR-URL: #30728 Fixes: #30721 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- default_resolve updated to pass parentURL into error - ERR_UNKNOWN_FILE_EXTENSION updated to include parentURL - test added to check for import message in error PR-URL: #30728 Fixes: #30721 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- default_resolve updated to pass parentURL into error - ERR_UNKNOWN_FILE_EXTENSION updated to include parentURL - test added to check for import message in error PR-URL: #30728 Fixes: #30721 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
When trying to import a JSON file, the error message provided is the following:
How to reproduce:
import './package.json'
node test.mjs
To help debug this error we should ensure it provides the name of the parent module that attempted the file extension load - something like
imported from /path/to/test.mjs
.The text was updated successfully, but these errors were encountered: