Forum Discussion
How To: Include a script in my web part
- Feb 26, 2019
Hi smithme ,
you can find best practics to add external libraries to spfx webpart here https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/basics/add-an-external-library
Talking about gstatic, if you are using plain Javascript, and not React, as per documentation, you need to reference external non-AMD module.
Here you can find a sample https://github.com/AJIXuMuK/issues/tree/master/google-charts
Cheers,
Federico
Hi mc1052
could you please try the following in config.json ?
"externals": { "TweenMax": "https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TweenMax.min.js"
}
Following the docs https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/basics/add-an-external-library I think you are trying to merge non-AMD Module procedure with cdn procedure.
Cheers,
Federico
FedericoPorceddu82 - Hi thanks for the response.
I tried running it as cdn:
1. npm install gsap
(https://www.npmjs.com/package/gsap )
2. config.json add external library: