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

Cannot re-export reserved words #490

Closed
Pauan opened this issue Dec 26, 2016 · 1 comment
Closed

Cannot re-export reserved words #490

Pauan opened this issue Dec 26, 2016 · 1 comment

Comments

@Pauan
Copy link

Pauan commented Dec 26, 2016

I am using acorn version 4.0.4 from npm.

Here is the code which is failing:

var acorn = require("acorn");

// SyntaxError: Unexpected token (1:9)
acorn.parse('export { var } from "foo/bar.js";', {
  sourceType: "module"
});

I believe that this code should work. I am basing that upon three things:

  1. Exporting/importing reserved words works fine:

    acorn.parse('export { foo as var };', {
      sourceType: "module"
    });
    
    acorn.parse('import { var as foo } from "foo/bar.js";', {
      sourceType: "module"
    });
    

    It is only re-exporting that breaks.

  2. I'm not an expert on the ES spec, but based upon the spec for ES2017, they seem to allow for IdentifierName with re-exports, therefore reserved words should be okay.

  3. Some other people have said that it's okay.

This is actually causing problems for me because I'm trying to integrate PureScript with Rollup (which uses acorn), but PureScript generates imports/exports which are reserved words.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant