Deploy selected webpart in SPFx Webpart Solution
Category
- [x] Question
- [ ] Typo
- [ ] Bug
- [ ] Additional article idea
Expected or Desired Behavior
We have created an SPFx webpart solution and it contains 5 web parts in it. 3 out of 5 web parts are related to one client and rest 2 web parts are related to another client. now I want to deploy this solution in two packages.
first package with first 3 web parts,
second package with last 2 web parts.
Both the client should not be able to see web parts which are not related to them.
Please let me know whether this is possible or not. If possible then how to achieve this.
Web Parts are defined in config.json, package is defined in package-solution.json. You could create a set of config.json and package-solution.json for each customer. That's what I did.
@craghavendra21 the easiest approach to achieve the kind of separation you mentioned would be to create two separate projects. Is there any reason why you put all web parts into a single project?
We just wanted to keep all the WebPart in one place, in a single solution. and we should be able to deploy only those web part which client is requested by the client.
@craghavendra21 I'm afraid it doesn't quite work that way. By analogy, if you were building a server-side solution, a single project would result in a single DLL. The same way, one SPFx project results in a single package referring to all components.
@waldekmastykarz Yes, in the server we have option to add web parts or components to feature and only web parts added in the feature will be deployed. so is there any way like this in spfx? Actually, we have developed 10 webparts for one client and our next client requirement is matching with first 5 webparts of the previous client. So we are planning to deploy only first five and skip last 5 webparts.
@craghavendra21 unfortunately you don't have such granular control in SPFx. Separating them out to different projects would be a more robust approach.
@waldekmastykarz Thanks, I have created two projects for now. But if SPFx introduces something like Features in SharePoint server farm solution then it would be very helpful. Where you can add and remove web parts or components to deploy by moving from left side to right or right to left respectively in the feature window. If SPFx has some JSON configuration kind of thing to add or remove web parts to be deployed then it would be very helpful.
Seems like this issue was resolved... last comment by @craghavendra21 implies a feature request which would be good for UserVoice: http://aka.ms/sp-dev-uservoice
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues