Browser: Identifier X has already been declared

The Solution to Browser: Identifier X has already been declared is


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.

~ Answered on 2016-03-21 20:09:48


Most Viewed Questions: