in.js:3: ERROR - Duplicate let / const / class declaration in the same scope is not allowed.
See original GitHub issueHi,
I have an error while compile a js file with ES6 code:
java -jar closure-compiler-v20170409.jar --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file=in.js out.js
in.js:3: ERROR - Duplicate let / const / class declaration in the same scope is not allowed.
class Storage {
^^^^^^^
1 error(s), 0 warning(s)
There is conflict name Storage
with something as I guess.
If I rename, for example, to _Storage
then compilation ends successfully.
"use strict";
class Storage {
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Why does var allow duplicate declaration but why does const ...
Both let and const are block-scoped, not function-scoped. This makes them work like variables in most other C-like languages. It turns out this ......
Read more >JS Tip of the Day: Declarations let, const and class Can't be ...
When declaring variables with let , const , and class , you'll need to be sure not to duplicate declarations of the same...
Read more >I get this error in the console: (Example) | Treehouse Community
This is apparently a problem Safari has with declaring a let/const variable that shares the same name as a selected id attribute.
Read more >Functions and Functional Programming
Now let us look at statements in the same scope, not in a nested function. With let and const declaration, accessing a variable...
Read more >ES6 core, It worth spending a day to learn - Medium
In es5, there are only two variable declarations, var and function. Four new let and const have been added to es6, and the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The original example doesn’t have an
import
orexport
statement in it, so closure-compiler doesn’t consider that to be a module. If you get the same error in a file that does contain either animport
orexport
, I suggest you file a new bug with that example.You can put an empty
export {};
into a file to mark it as a module.