We have a SharePoint hosted app. This app require some scripts from SharePoint; MicrosoftAjax.js, init.js, sp.runtime.js, sp.js, sp.taxonomy.js and sp.workflowservices.js.
We load all these from /_layouts/15/, except for MicrosoftAjax which we load from ajax.aspnetcdn.com.
What we are thinking about is to bundle all these files into our app.js. We use gulp to build our app, so we only have one file, except for the files above.
Problems I can think of:
- How can we detect changes in the built in scripts?
- Are there differences between on-premise and SharePoint online?
- Are any parts of the scripts dynamic (variables set when requesting the scritps)?
We had problems with MicrosoftAjax.js, once it was removed from 15 hive, and once the DNS did not resolve.
index.html
page, and we don't need to load anything on demand or asynchronously.app.js
-file is in any case bundled with the app, so it can not be changed after deploy, which in theory makes it safer than pointing to built in scripts which can be changed, even by third party be it on-premise.