Browser: Identifier X has already been declared
I had a very close issue but in my case, it was Identifier 'e' has already been declared
.
In my case caused because of using try {} catch (e) { var e = ... }
where letter e
is generated via minifier (uglifier).
So better solution could be use catch(ex){}
(ex
as an Exception
)
Hope somebody who searched with the similar question could find this question helpful.
But I have declared that var in the top of the other files.
That's the problem. After all, this makes multiple declarations for the same name in the same (global) scope - which will throw an error with const
.
Instead, use var
, use only one declaration in your main file, or only assign to window.APP
exclusively.
Or use ES6 modules right away, and let your module bundler/loader deal with exposing them as expected.