Skip to content
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: fix error message about importing names from cjs #33882

Commits on Jun 15, 2020

  1. 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;
    ```
    fabiosantoscode committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    2a115b5 View commit details
    Browse the repository at this point in the history