0

When I tried to deploy the package in sharepoint everytime it refers to the localhost resources

Can someone please let me know from where I can change this configuration so that it should refer from the CDN path instead of localhost

Below is my package-solution.json

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "mega-menu-sp-fx-client-side-solution",
    "id": "8f49d75c-5a49-4657-b81b-0290f239350f",
    "version": "10.0.0.0",
    "includeClientSideAssets": true,
    "skipFeatureDeployment": true,
    "isDomainIsolated": false,
    "features": [
      {
        "title": "Application Extension - Deployment of custom action.",
        "description": "Deploys a custom action with ClientSideComponentId association",
        "id": "0d2345df-2a49-4ce9-ba2d-bee7ad3e7a02",
        "version": "10.0.0.0",
        "assets": {
          "elementManifests": [
            "elements.xml",
            "clientsideinstance.xml"
          ]
        }
      }
    ]
  },
  "paths": {
    "zippedPackage": "solution/mega-menu-sp-fx.sppkg"
  }
}

Below is my write-manifest.json

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
  "cdnBasePath": "https://Mytenant.sharepoint.com/sites/MyTechTheme/MenuFiles"
}
Rajesh Akshith
  • 301
  • 3
  • 14

2 Answers2

2

I tried to figure out whats the issue. For publishing instead of gulp package-solution --ship I had used gulp package-solution so unless and until we don't mention --ship it wont take the references for CDN

So for deploying the package in SPO we need to use gulp bundle --ship and gulp package-solution --ship

Rajesh Akshith
  • 301
  • 3
  • 14
0

As per this thread, to load SPFx assets from a CDN or SharePoint library, set the value of "includeClientSideAssets" to false.

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    ...
    "includeClientSideAssets": false,
    ...
  }
}
Besworks
  • 4,123
  • 1
  • 18
  • 34
Lee
  • 5,305
  • 1
  • 6
  • 12