I often use Script editors or Content Editor Web Parts linked to an Html file to launch a client application in SharePoint. My base approach to all these apps is to:
- Register all the scripts as with Script on Demand
- Call LoadMultiple passing in the Script Keys
- Wrapping it all in a closure
Uncaught TypeError: Cannot read property 'version' of undefined Error: ReferenceError: moment is not defined
What I had missed was to delcare the dependency between moment.js and moment-timezone.js.
Here's an example of my client app with the fix:
The moral of the story is this line:
That let's SharePoint know that we want to load up moment.js before moment-timezone.js.