-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
module: refine module type mismatch error cases #35426
Conversation
Review requested:
|
Ping @nodejs/modules-active-members for review. It could even be worth fast-tracking this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm and +1 to fast-track
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR-URL: #35426 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Landed in 726143e. |
PR-URL: nodejs#35426 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
PR-URL: #35426 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
PR-URL: nodejs#35426 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
PR-URL: nodejs#35426 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
This fixes up the error message in the case when importing a CJS module that contains ES module syntax.
Specifically, hiding the cjs-module-lexer parse failure message, and also then surfacing the warning context that informs the user about the "type" and ".mjs" format indicators to be able to correct the underlying issue.
Before this change:
where
module.cjs
containsexport
/import
syntax so is not valid CommonJS, would output as per the error in #35425.With this change, we now get an error like:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes