6 Feb 2013 3:43 AM #1
Issues with the microloader and OpenLayers and other scripts
Hello! I've run into an issue that I have figured out, but still not quite resolved.
Our Sencha Touch+OpenLayers application was working fine during development, but the optimized release build failed because OpenLayers could no longer be found. It was as if it never had been loaded, even though I could clearly see it being downloaded. The debugger in Chrome reported several errors like "OpenLayers is not defined".
Last edited by SimonTheSorcerer; 6 Feb 2013 at 3:45 AM. Reason: typo
6 Feb 2013 8:09 AM #2
Have you tried changing the production microloader so it does an indirect global eval?
7 Feb 2013 2:56 AM #3
Yes, and it seems to be working. And I have yet to notice any adverse effects, nor did I expect any, but the subtleties of this language makes me a bit cautious To clarify, I have change the eval-line in the microloader to read like this:
8 Feb 2013 8:02 AM #4
Agreed, since it's pointless to eval the loaded assets in a temporary context
22 Apr 2013 8:33 AM #5
@SimonTheSorcerer, thank you, this saved my day.
I'm not sure I understand what the "(42, eval)" does, but it works great.
23 Apr 2013 3:11 AM #6
That's how I understand it, anyway. I'm glad it helped someone else.
23 Apr 2013 3:36 AM #7
Thank you SimonTheSorcerer for your explanation.
I have also stumbled on the following blog post which indicates that a simple solution would be to build using package mode instead of production mode, which seems to work indeed :