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

SyntaxError: Unexpected token default #33

Closed
mbostock opened this issue Jun 26, 2015 · 3 comments
Closed

SyntaxError: Unexpected token default #33

mbostock opened this issue Jun 26, 2015 · 3 comments

Comments

@mbostock
Copy link
Contributor

This may or may not be related to #32. Here’s the test case:

https://gist.github.com/mbostock/d7717d61446600938e47

The problem is:

var default = Baz(baz);
    ^^^^^^^
SyntaxError: Unexpected token default
@caridy
Copy link

caridy commented Jun 26, 2015

right, `default`` is a reserved keyword, my recommendation is to use a custom generated token when creating a local binding for the default export https://gist.github.com/mbostock/d7717d61446600938e47#file-build-js-L7

@mbostock
Copy link
Contributor Author

Yes, Rollup should not be generating a var default.

@Rich-Harris
Copy link
Contributor

Ordinarily default exports are given a 'suggested' name by the first encountered module that imports them (i.e. import foo from './foo' causes the default export from foo.js to be named foo). In this case the Baz function is included (because functions are deemed capable of mutating their arguments - eventually need to get a bit more sophisticated about this) but because the default export isn't used, there's no suggested name. Rollup accounts for this scenario in 0.8.3.

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

3 participants