Correctly reference JavaScript libraries in your SharePoint Framework project

SharePoint Framework Script Check

Using Rencore SPCAF Script Check you can easily reference external libraries in SharePoint Framework solutions the right way.

Additionally, you can ensure, that the CDN they are using is well performing. Read more about how it works on our blog.

wrong format? let us know

Together with your report we will receive the URL of the script you analyzed. We will use it to improve our detection mechanism. Whatever you send us, we won't share with anyone else.

To reference this script in your SharePoint Framework solution:
  1. In the code editor, open your project
  2. Open the ./config/config.json file
  3. In the externals section add the following snippet:
    "myLibrary": ""
              
    for example:
    "jquery": "https://code.jquery.com/jquery-2.2.4.min.js"
              
  4. In the externals section add the following snippet:
    "myLibrary": {
      "path": "",
      "globalName": "myLibrary"
    }
              
    for example:
    "angular": {
      "path": "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js",
      "globalName": "angular"
    }
              
The quality of the CDN that you are using is:
Congratulations! Your script is hosted on a properly configured CDN. Visit rencore.com and learn more about how to improve the quality of your SharePoint Framework solutions.
There is some room for improvement of your CDN. Visit rencore.com and learn more about how to improve the performance of your SharePoint Framework solutions.
Your CDN has considerable negative impact on the performance of your solutions and you should consider using another CDN instead. Visit rencore.com and learn more about how to improve the performance of your SharePoint Framework solutions.

Examples:

Average quality and a non-module result:

https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js

Good quality and module result:

https://code.jquery.com/jquery-2.2.4.min.js

Powered by Rencore SPCAF