Unverified Commit 42ebe7ab authored by Fábio Santos's avatar Fábio Santos Committed by Shelley Vohr
Browse files

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: https://github.com/nodejs/node/pull/33882


Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarMichaël Zasso <targos@protonmail.com>
Reviewed-By: default avatarGuy Bedford <guybedford@gmail.com>
Reviewed-By: default avatarMyles Borins <myles.borins@gmail.com>
parent 13d1caed
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment