I've searched the forum but can't find anything on this. I have the following line in a file by itself:
FormState = new ReactiveState();
Other files in the package can't reference FormState. How do I make it package-scoped instead of file-scoped?
Make sure the files referencing your global variable are added after the file with the declaration. For example:
api.addFiles('file-with-global-var.js');
api.addFiles('file-using-global-var.js');
If these were reversed, you'd probably see an error. Also make sure to check they are both accessible from the same environment. For example:
api.addFiles('file-with-global-var.js', 'client');
api.addFiles('file-using-global-var.js', 'server');
would obviously be a problem, as the server code couldn't read a variable declared only on the client.