0

I'm following the SPFx Getting started guide for web parts and I'm at part 4.

In the note at the top of the page, there is mention of hosting from a SharePoint Library from your tenant (immediately after the "Azure CDN" link), but there is no reference of how to do this. Are there any guides out there that I could follow to try this method?

  • 1
    For more details about Hosting your SPFx Client Side Webpart on Office 365 public CDN go to the following link : blog.mastykarz.nl/… – Youssef Moumen El idrissi Feb 13 '18 at 21:43
  • I guess there's not a way to do this without needing to be an admin and enable the CDN settings? – vanblart Feb 14 '18 at 13:23
4

While CDNs are good for performance, you dont need to necessarily enable them just to use SPFx webparts.

Just modify the Config > write-manifests.json and add your SharePoint location as below:

{
  "$schema": "https://dev.office.com/json-schemas/spfx-build/write-manifests.schema.json",
  "cdnBasePath": "https://tenantname.sharepoint.com/sites/test/SiteAssets/"
}

Upload your artefacts in the Site Assets or any other document library.

After that, run the gulp bundle --ship and gulp package-solution --ship and follow the instructions mentioned in the link that you shared and upload the app in app catalog.

Using this cdnBasePath you can consume files directly from SharePoint library itself instead of enabling Office 365 CDN or using Azure or another CDN provider.

  • When you say artefacts, do you mean the temp/deploy/ files? – vanblart Feb 15 '18 at 13:50
  • (Along with my previous question) I am able to add the app to my site contents, but after if finishes installing am not able to add it to a page. Is this because I didn't upload the correct things to the SiteAssets library? Or is this caused by something else? – vanblart Feb 15 '18 at 14:05
  • 1)Yes, temp deploy files. It's the same procedure as mentioned. 2) could be something else. Is it deployed correctly? – Gautam Sheth Feb 15 '18 at 14:44
  • Try and deploy a simple hello world spfx webpart to test this out. Will help isolate the problem – Gautam Sheth Feb 15 '18 at 15:08
  • Deploying a hello-world part worked properly. The one thing i noticed was that the deploy file had 3 files in it instead of the 2 that my original part had. I tried gulp clean and rebuilding, but it still only created 2 files. – vanblart Feb 15 '18 at 15:54
0

yes you need to create and configure a azure storage account but need to link it into azure.

so first do this section to setup azure cdn link to create the storage account

https://docs.microsoft.com/en-us/azure/cdn/cdn-create-a-storage-account-with-cdn

then follow on with this to setup the link in azure and the spfx webpart to link to the cdn instead

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/deploy-web-part-to-cdn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.