SharePoint Framework development with SharePoint 2016 Feature Pack 2
SharePoint 2016 Feature Pack 2 supports SharePoint Framework client-side web parts hosted in classic SharePoint pages.
An introduction to SharePoint Framework development in SharePoint 2016 using Feature Pack 2 is also covered in the following video on the SharePoint PnP YouTube Channel.
Which version of the SharePoint Framework to use
Because SharePoint Online and SharePoint 2016 have different release cycles for new capabilities, they also have different capabilities when it comes to the SharePoint Framework. SharePoint Online always uses the latest version of the SharePoint Framework, but SharePoint 2016 only supports the version that matches the server-side dependencies of the deployed packages.
SharePoint 2016 Feature Pack 2 supports SharePoint Framework client-side web parts hosted on classic SharePoint pages built by using the SharePoint Framework v1.1.0. This means that when you are targeting the SharePoint 2016 platform, you need to use the SharePoint Framework v1.1.0 due to the server-side version dependencies.
If you are planning to use the same client-side web parts in both SharePoint 2016 and in SharePoint Online, you need to use the SharePoint Framework v1.1.0 as your baseline version to ensure that the web part works in both environments.
Starting from version 1.3, the SharePoint Framework Yeoman generator supports scaffolding solutions that use both the latest version of the SharePoint Framework meant for use with SharePoint Online, and solutions that can be used with SharePoint on-premises based on the v1.1.0 of the SharePoint Framework. You don't need to install a separate version of the SharePoint Framework Yeoman generator to scaffold solutions meant for use with SharePoint on-premises.
Starting from version 1.4, the SharePoint Framework Yeoman generator supports a new attribute of
includeClientSideAssets, which can be used to indicate that assets should be included in the sppkg package. This capability is, however, only currently supported in SharePoint Online. When a solution is targeted to on-premises, this attribute in
package-solution.json should be updated as
Hosting your solution for on-premises deployment
Getting SharePoint Framework client-side web parts deployed to on-premises requires two distinct actions:
- Deployment of the solution package to the SharePoint app catalog
- Azure CDN. Similar setup as with SharePoint Online. Requires en-users to have Internet connectivity.
- SharePoint 2016. You can also host your files in the local SharePoint farm itself. You can, for example, define a standardized site in your farm where all the SharePoint Framework assets are being hosted. Take note, however, that by default, .json files are not allowed to be uploaded to SharePoint 2016 libraries, so farm level settings must be adjusted for this option.
For more information about blocked file types in SharePoint 2016, see the following support article: Types of files that cannot be added to a list or library.
Development environment considerations
When you are developing SharePoint Framework client-side web parts, you need Internet connectivity to access npm packages. This is required when solutions are being scaffolded by using the SharePoint Framework Yeoman templates.
If Internet access is not available for the development machines, you can set up a local on-premises registry for the required npm packages. However, this requires additional software and a significant amount of work to set up and maintain local package versions with packages in the actual npm gallery.
The Team-based development on the SharePoint Framework guidance document includes different options for development environment setup including when you might need to support multiple SharePoint Framework versions.
Determine which version was used for a solution
If you have existing SharePoint Framework solutions and you'd like to confirm which version of the SharePoint Framework was used for them, you'll need to check the following locations:
.yo-rc.json. File in the solution's root folder that stores the SharePoint Framework Yeoman template version used when the solution was created.
package.json. File in the solution's root folder that contains references to package versions used in the solution.
npm-shrinkwrap.json. File in the solution's root folder that contains information about the exact versions used (if you used the
npm shrinkwrapcommand to lock down the exact versions of the solution).
package.json. File in the node_modules/@microsoft/sp-webpart-base folder that contains a version attribute matching the used SharePoint Framework version, if you have installed packages to your solution.