0
  1. I created modern script editor web part using this : https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-script-editor
  2. Enabled CDN using SharePoint Power Management Shell https://www.c-sharpcorner.com/article/enable-cdn-in-your-office-365-tenant-for-spfx-webpart/
  3. Created CDN folder also in Document library

But when I run command gulp --ship cdn files are not created.

What am I missing?.

2 Answers 2

0

This does not directly answer your question, but I think it will assist you in moving forward. In the project you linked, the includeClientSideAssets setting in package-solution.json is set to true. This means that you do not need to explicitly deploy the bundle files (static assets) to the Office 365 CDN. The bundle files will be included in the app package (the .sppkg file) and will automatically be added to the CDN when the package is deployed to the app catalog.

Screen capture of package-solution.json

As to your actual question, I'm not sure why the bundle files were not output to the temp/deploy folder. I haven't looked into this so I can only make an educated guess. My guess is that you need to take two steps to make this happen. First, set includeClientSideAssets setting in package-solution.json to false. Second, set the cdnBasePath property in write-manifests.json to the URL to the folder you created in the CDN.

Screen capture of write-manifests.json

I hope this helps.

2
  • I may have found the reason why bundle files were not output to the temp/deploy folder. The default location for resources used in deployments changed from temp/deploy to releases/assets in the SharePoint Framework v1.12.1. Are you using SPFx v1.12.1 or later? Apr 27, 2022 at 11:07
  • yes I am using SPFX v14.18.0 that's why I am facing these issues,webpart is working on hosted workbench but not taking any code which I am writing in text area like I wrote simple <script> console.log("hello");</script> Apr 27, 2022 at 11:47
0

Thank you for your answer.

I did the same as per you suggestion:

I did the same as per you suggestion

Specified CDN path as well:

Specified CDN path as well

My temp folder has these files .I am sorry If I did any silly mistake as I am new to this, learning everyday

My temp folder has these files .I am sorry If I did any silly mistake as I am new to this, learning everyday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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