10

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:

  1. How can we detect changes in the built in scripts?
  2. Are there differences between on-premise and SharePoint online?
  3. 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.

10
  • So you are trying to replace SharePoints SOD with your own? Nov 17, 2015 at 10:59
  • 1
    @DannyEngelman We simply don't use any dynamic loading. Our app has a very light weight index.html page, and we don't need to load anything on demand or asynchronously.
    – eirikb
    Nov 17, 2015 at 11:03
  • 1
    From a Governance point of view I would not accept any add-ins that replaces default Microsoft scripts with their own. Your add-in is payload and if it changes anything in the trucks engine I can imagine Microsoft won't give support either. Nov 17, 2015 at 11:54
  • @DannyEngelman The scripts are only client side scripts, libraries that can be changed externally in any case, be it be re-evaluating or overriding the prototype. The 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.
    – eirikb
    Nov 17, 2015 at 12:30
  • OnPrem could vary iguess, depending on patch/service pack they run. Some function in the init.js on O365 uses _spPageContextInfo.userId etc, that is not available onprem (on my version of 2013). Nov 17, 2015 at 15:20

1 Answer 1

0

You're bundling everything that comes with Microsoft SharePoint into your own js file. This could lead into the typical problem, which is your first question, you can't never detect changes in the built-in scripts.

Unless if you use RPA or PowerShell to frequently download those scripts and compare, re-bundle the script if needed and republish whatever customization you're trying to do.

Even when the evidence proof that bundling those scripts works both on-premises and SPO, I would still avoid doing so.

Yes, there are differences between on-premises and SPO. Even with the most frequent updates installed or if you're using subscription model, SharePoint on-premises is always behind, while SharePoint Online is always ahead of updates and features. That's practically how Microsoft sells SharePoint Online.

"Are any parts of the scripts dynamic (variables set when requesting the scritps)?" - I have no idea on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.