lukas
lukas

Reputation: 574

Loading external libraries in a SharePoint WebPart

I am working with SharePoint Framework and building a custom WebPart for SharePoint Online. Following the instructions here, I can't get any libraries loaded from external CDNs.

This is the error I get every time: The entry point for component "my-component-id-here" (SalesNavigationWebPart) has a dependency on "@microsoft/sp-loader" that is not declared in the manifest.

SPFx Error loading external libraries

I tried to load it by adding an entry to externals: {} in config.json, but the error is still there. Any ideas on how to fix this?

Upvotes: 0

Views: 883

Answers (1)

Vetrivelmurugan
Vetrivelmurugan

Reputation: 33

In my case, I uploaded the .sppkg without importing the sp-loader (in code) first time. Next time even if you add the sp-loaded and deploy the cdn files it won't work. you need to use below commands and redeploy .sppkg file in app catalog.

gulp clean
gulp bundle --ship
gulp package-solution --ship

Further reading, While you execute the gulp bundle --ship command inside the temp/deploy folder there will be a .json file with the GUID of your web part. It has the reference to the sp-loader module.

Upvotes: 1

Related Questions