I will be creating an spfx solution which will host various web parts, extensions, content type and list definitions. To my understanding the best approach is to have a single solution this way external packages can be shared between web parts and connected web parts will be possible among other benefits.

My question arises when I start creating lists that some of these web parts will consume from, the issue I am seeing is that on any site collection that the app is installed on these lists will be created automatically even if they are not needed (for example, if I have a list that should only live on the root site collection). In older versions of SharePoint we made multiple features and had the possibility of putting these lists and their corresponding web parts (assuming they have an associated web part) in their own features and enable the features on the sites that will use them. According to my research Microsoft does allow multiple feature creation in spfx solutions however it is not recommended. However, I did attempt a test solution with more than one feature and as soon as I did this, the solution would not work anymore. Either way if I did manage to get this working, it is not a recommended approach and even with that the feature would automatically come enabled as soon as I install the solution on the site therefore creating the list and defeating the purpose...

Currently what I am considering is having a tenant wide solution with my application customizer and all my web parts and then split my lists into their own solutions which would host all lists grouped by the site they should live in. However I don't know if this is the correct process and one of the issues I see with this is that you will have to install this solution in order to use certain web parts on a site, however even if the list is not installed the web parts will still be available on all sites which would cause the web part to break.

With that being said what is the best approach to get around this situation? Should we put everything into a single solution and just let the lists be created on all site collections and ignore them? Should we manually delete them? should these situations be isolated into their own solutions and therefore create multiple solutions based off of "is this lists required on this site or not?" (similar to what I described in the above paragraph)? or should each web part, application customizer, etc. be in its own solution (the problem I see with this last option is that and 3rd party packages would be installed in each solution therefore making SharePoint load these dependencies multiple times... Also when there is an update you would have to do this on a one by one basis and finally you would lose the opportunity to reuse components)?


Your Answer

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