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
var, use only one declaration in your main file, or only assign to
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