3

I am working on a development environment on SP 2016 on prem with feature pack 2. I have created a "Hello world" web part following this example. I am trying to deploy the SPFx web part to a classic on prem page, so I created the app catalog where I added the .sppkg - file. I managed to add the web part to the classic page by using the ribbon, but the web part only works when I am running "gulp - serve" in the background on the project. Is it suppoed to be like this? I thought adding the web part to the catalog should do the trick for me.

If I have to deploy the SPFx-web parts the oldschool way, like in this sample, I will be very dissapointed: https://rasper87.wordpress.com/2018/04/24/provision-spfx-web-parts-to-classic-sites-part-1-include-spfx-assets-package-inside-wsp/

It is very easy to get confused with all the documentation and samples out there with add-ins, app catalog, developer site, apps and then SPFx online and on prem.

1 Answer 1

8

Please see SharePoint Framework development with SharePoint 2016 Feature Pack 2

In particular, see the section on deployment.

Hosting your solution

Make sure to heed the part about removing the restriction on .json files being uploaded if you are going to host your JavaScript files in SharePoint.

Here are the steps I used to deploy a SharePoint Framework web part named Hello World to SharePoint 2016. In this case I chose to host the JavaScript files in SharePoint.

I removed the block on uploading .json files in the web application.

Blocked files

I created a new document library named CDN and then a folder named Hello World inside that document library.

I set the cndBasePath property in the write-manifests.json file in my web part project to point to this document library.

write-manifests

After running gulp bundle --ship I copied the files in the temp/deploy folder of my web part project to the Hello World folder in the CDN document library.

JavaScript files in project

JavaScript files in SharePoint

Finally I added my Hello World web part to a SharePoint 2016 web part page.

Running web part

2

Your Answer

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

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