Deploy artifacts with spfx webparts

SharePoint framework (commonly known as spfx) webparts can be used to deploy the artifacts like js/css/image files etc. There are multiple options to host your artifacts. 
  • First option is to host to CDN (like azure)
  • Other option is to include that within the package and then deploy to appcatalog along with sppkg file.

Host to CDN

In order to host the webparts to Azure or any CDN,  open copy-assets.json file in config folder of your spfx webpart and update the CDN path. This CDN path can be any SharePoint library or Azure CDN. Basically any path which is accessible using http protocol. If you are publishing to Azure CDN please make sure to add the azure credentials in deploy-azure-storage.json file.


Deploy to AppCatalog

In case you want to deploy the artifacts to app catalog, package-solution.json file under config folder and make sure that includeClientSideAssets is set to true. Once this is set when you will deploy the webpart to the webpart gallary. 



The assets will be deployed to ClientSideAssets hidden library under appcatalog as shown below. You can navigate directly to the URL https://yourtennant/appcatalog/clientsideassets


Hope this helps!

Happy SharePointing...

Comments

Popular posts from this blog

Read all lists/views/fields using pnpjs in spfx webpart