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

When using EG in the browser, variables aren't scoped correctly #19

Open
davej opened this issue Jun 20, 2015 · 1 comment
Open

When using EG in the browser, variables aren't scoped correctly #19

davej opened this issue Jun 20, 2015 · 1 comment

Comments

@davej
Copy link

davej commented Jun 20, 2015

The specific error I get (in JS) is:

"Uncaught TypeError: Identifier '$targ$0' has already been declared"

This is because the let variables leak out of the files and into the global context. I suggest that EG provide a param to wrap the code in an IIFE (or possibly make it default behaviour?).

This is only an issue when using ES6 mode (because babel converts let to var) when running in a browser (not an issue in node).

@davej
Copy link
Author

davej commented Jun 20, 2015

Perhaps an easier alternative might be just to point people towards something like gulp-iife, if you'd prefer not to deal with this in EG.

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