-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: print better message on esm import error
Use the same approach as a previous PR to include the offending line in the output and underline imports of inexistent exports. PR-URL: #17786 Fixes: #17785 Refs: #17281 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
14eb97e
commit 3b2d8cb
Showing
8 changed files
with
42 additions
and
1 deletion.
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,2 @@ | ||
export const foo = 'foo'; | ||
export const bar = 'bar'; |
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 @@ | ||
import { foo, notfound } from './module-named-exports'; |
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 @@ | ||
// Flags: --experimental-modules | ||
/* eslint-disable no-unused-vars */ | ||
import '../common'; | ||
import { | ||
foo, | ||
notfound | ||
} from '../fixtures/es-module-loaders/module-named-exports'; |
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 @@ | ||
(node:*) ExperimentalWarning: The ESM module loader is experimental. | ||
file:///*/test/message/esm_display_syntax_error_import.mjs:6 | ||
notfound | ||
^^^^^^^^ | ||
SyntaxError: The requested module does not provide an export named 'notfound' | ||
at ModuleJob._instantiate (internal/loader/ModuleJob.js:*:*) | ||
at <anonymous> |
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,3 @@ | ||
// Flags: --experimental-modules | ||
import '../common'; | ||
import '../fixtures/es-module-loaders/syntax-error-import'; |
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 @@ | ||
(node:*) ExperimentalWarning: The ESM module loader is experimental. | ||
file:///*/test/fixtures/es-module-loaders/syntax-error-import.mjs:1 | ||
import { foo, notfound } from './module-named-exports'; | ||
^^^^^^^^ | ||
SyntaxError: The requested module does not provide an export named 'notfound' | ||
at ModuleJob._instantiate (internal/loader/ModuleJob.js:*:*) | ||
at <anonymous> |