Skip to content

Parse error for quoted export/import names #3961

Open

Description

// e.mjs
const a = 'print me';
export { a as "dove" };
// i.mjs
import { "dove" as b } from './e.mjs';
console.log(b);

"dove" is the quoted name, and this code works (i.mjs prints print me).

Spec reference:
ModuleExportName can be StringLiteral.

However, compiler can't parse that:

e.mjs:3:14: ERROR - [JSC_PARSE_ERROR] Parse error. 'identifier' expected
  3| export { a as "dove" };
                   ^
i.mjs:2:9: ERROR - [JSC_PARSE_ERROR] Parse error. '}' expected
  2| import { "dove" as b } from './e.mjs';
              ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions