SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 1k forks source link

How to add SPFx webpart and Extension in Single Project #9800

Open devanihiren opened 2 months ago

devanihiren commented 2 months ago

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

Additional environment details

Issue description

I need to generate a project for webparts and extensions all together in a single development project..provide steps for webpart and extension in a single setup.

JoelBool commented 2 months ago

In package-solution.json you can add multiple objects in the 'features' array. For example:

"features": [
      {
        "title": "Webparts",
        "description": "Multiple web part",
        "id": "152e3073-67f7-49f3-adf1-424872eeb342",
        "version": "1.0.0.0",
        "componentIds": [
          "35b9bffe-0f57-4796-9821-ec62b48105d4",
          "<another web part guid if you like>",
          "<and another>"
        ]
      },
      {
        "title": "First command set.",
        "description": "A command set",
        "id": "22f95bbd-aabe-4622-8e28-c95a74ea2d3b",
        "version": "1.0.0.0",
        "componentIds": [
          "f2a5a042-ddae-476b-b202-4c86eab81d83"
        ],
        "assets": {
          "elementManifests": [
            "FirstCommandSet_Elements.xml",
            "FirstCommandSet_Instance.xml"
          ]
        }
      },
      {
        "title": "Second command set.",
        "description": "A command set",
        "id": "60e482a7-1a1c-48b8-b1c3-218031a51a2d",
        "version": "1.0.0.0",
        "componentIds": [
          "e8e344c0-b4ce-496e-a0ae-3b93dabdf12d"
        ],
        "assets": {
          "elementManifests": [
            "SecondCommandSet_Elements.xml",
            "SecondCommandSet_Instance.xml"
          ]
        }
      }
    ],
StfBauer commented 2 months ago

@devanihiren you navigate to the project folder and start:

yo @microsoft/sharepoint

again. This will add additional extensions to your solution.