What are the advantages/disadvantages of adding JavaScript libraries as a static resource?

I maintain a product on the AppExchange that currently references both JQuery and custom JavaScript that are included in a static resource. Now that I am making some additional updates to the package, I am thinking that it would be easier to manage the scripts on the server rather than adding them to the package.

Is this a dealer’s choice type of situation, or are there specific advantages or disadvantages of linking directly to external JavaScript files versus adding the scripts to static resources?

Answer

I suspect that the benefits of static resource are:

  1. Salesforce should auto-cache requests for static resources
  2. If the CDN you reference the external JS file from happens to go down for whatever reason, you aren’t reliant on it.

Attribution
Source : Link , Question Author : Brad Ullery , Answer Author : Michael Welburn

Leave a Comment