Forum Discussion

john john's avatar
john john
Steel Contributor
Jan 07, 2019

Why we should avoid using non-module scripts inside our SPFX web parts

I am reading this article from Microsoft Use existing JavaScript libraries in SharePoint Framework client-side web parts. now they mentioned 2 confusing things,  about using external scripts rather than adding them to the web part bundle. Referencing external scripts, will keep our web part project size smaller, and also the script might be already loaded inside the user browser, so we will have extra performance improvement. but later the documentation mentioned this:-

 

SharePoint Framework supports loading non-module scripts, you should strive to avoid using them whenever possible.

 

so i am a bit confused on this , should we reference the scripts from external sources and define them as non-module scripts ? or we should try not to have non-module scripts?

Thanks

 

 

 

No RepliesBe the first to reply