Cordova - Uncaught ReferenceError: xxx is not defined


#1

My app works fine as a web app and I decided to test it out as a mobile app just now (on an Android device), but I get the following error:

Uncaught ReferenceError: PLAYERS_PER_TEAM is not defined

PLAYERS_PER_TEAM and other variables are globals defined in the file: /lib/_config/models.js (it’s just a file of constants that I currently use for my app). Is there a reason the cordova app sees these variables as undefined, but the web app is fine with it?

How do I fix the problem?

Thanks


#2

Cordova can be pretty wonky on the “unusual” filenames. What happens if you put your file in a folder that doesn’t start with an underscore?


#3

Thanks. Changing _config to aconfig solved the problem.