0

I have an SPFx project with two webparts.

-src

--webpart1

--webpart2

When I run gulp bundle --ship and gulp package-solution --ship both webparts are packaged. Is it possible to only package one of the webparts? For example if I make changes to webpart1, it would be helpful to deploy that to my tenant independently.

1
  • Are you deploying the packages by uploading manually? In that case you can generate packages using same process and just upload package of webpart1. Mar 28, 2023 at 3:31

2 Answers 2

1

As you have added both web parts in to one solution, it's not possible to package single web part.

You create new new solution and copy your one of the web part code to another solution and also remove it from current solution and then you can create package separately.

Important:

Make sure that if you create new solution and move your one of the web part to new solution then pages where you have added web part already will stop working and there you need to add your SPFx web part again.

0

You can make the backup and delete the webpart from your main project and comment the code for the webpart in the config.json

"your webpart": {
      "components": [
        {
          "entrypoint": "./lib/webparts/iprsDashboardV1/IprsDashboardV1WebPart.js",
          "manifest": "./src/webparts/iprsDashboardV1/IprsDashboardV1WebPart.manifest.json"
        }
      ]
    }
  },

Also remove this code from the botton in the same file

 "localizedResources": {
    "IprsNewWebPartStrings": "lib/webparts/iprsNew/loc/{locale}.js"// remove this line only
    }

Delete the folder from the lib > webpart >your webpartfolder (delete it)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.