-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: fix error message about importing names from cjs
When importing specific names from a CJS module, and renaming them using `as`, the example fix in the error message erroneously contains the keyword `as` in the destructuring variable declaration. Example of this issue: import { parse as acornParse } from "acorn"; ^^^^^ SyntaxError: The requested module 'acorn' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export. For example: import pkg from 'acorn'; const { parse as acornParse } = pkg; PR-URL: #33882 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Myles Borins <[email protected]>
- Loading branch information
1 parent
13d1cae
commit 42ebe7a
Showing
3 changed files
with
18 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
1 change: 1 addition & 0 deletions
1
test/fixtures/es-modules/package-cjs-named-error/renamed-import.mjs
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 { comeOn as comeOnRenamed } from "./fail.cjs" |