SharePoint Framework Library Components provide you an option to create shared code, which can be independently versioned and deployed in the SharePoint tenant.
The Library Component code can be then used and referenced cross all the components (Web Parts, Extensions, etc.) in the SharePoint tenant. Using the SharePoint app catalog deployment method, the Library Components are made available automatically to the other SharePoint Framework components.
SharePoint Framework Library Components essentially provide you the opportunity to employ a “Write Once, Use Everywhere” development model. The functionally provided within the Library Component can be accessed by multiple other SharePoint Framework components.
This video shows how you can actively develop both your Library Component and your Web Part or Extension simultaneously in parallel, with each benefiting from gulp actively re-transpiling the solution upon saving.
Video Highlights:
- How to “gulp serve” the Library Component and Web Part/Extension at the same time.
- Changes need to avoid port conflicts
- Benefits of simultaneous parallel development
- Demo
Other Videos:
Useful Links:
- Library Component Overview:
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/library-component-overview
- Library Component Tutorial:
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/library-component-tutorial
- NPM Link Official Documentation:
https://docs.npmjs.com/cli/link
- Blog Post on Library Components by Sergei Sergeev:
https://spblog.net/post/2019/03/26/a-new-beast-in-sharepoint-framework-development-library-component
- Sample: Using Service Locator pattern in SPFx with Library components by Vardhaman Deshpande:
https://github.com/vman/SPFx-Library-Service-Scopes