Sharepoint - Can SPFx Webpart and Extension exist in a single app?

Yes, you can have multiple webparts or extensions in the same solution. Think of it as a Visual Studio solution with multiple projects (i.e one sln file and multiple dlls).

To add a webpart/extension in the existing solution, you simply need to run the yeoman generator again.

yo @microsoft/sharepoint - run this command in your current solution and the generator is intelligent enough to add the webpart/extension. It internally checks for config.json file and if it exists appends the new "project" there.

enter image description here

To see those, 2 for example(1 webpart and 1 extension), you can go to the config > config.json file. In that file, you will see it as below:

enter image description here

Tags:

Spfx