A global variable is getting a reference error on the first-time load

In our application, we defined a variable(global) in the .js file inside the lib folder. This variable shows that it is not defined on the first application launch. We removed the variable and retested it and found no problem. Can someone explain the exact problem?

There is a script tried to access that variable before the file got included.
You can try to put that global variable definition to very top level tree, e.g main.js or index.js. It depends on your application.


Okay will try.
Thank you.