Monday, June 28, 2021

How to change SPFx bundle file name?

 Ans:-

Whenever you run gulp bundle –ship command, a new bundle file will be created with some prefix and it appends with GUID at the end. GUID is auto generated to maintain the uniqueness of a file, but you can change the prefix of that bundle file.

Go to config folder in your project and look for config.json, the highlighted content in the below snippet is your bundled file’s prefix. You can change it as per your wish with a meaningful name.

{  

  "$schema": "https://dev.office.com/json-schemas/spfx-build/config.2.0.schema.json",  

  "version": "2.0",  

  "bundles": {  

    "first-sp-fx-web-part": {  

      "components": [  

        {  

          "entrypoint": "./lib/webparts/firstSpFx1/FirstSpFxWebPart.js",  

          "manifest": "./src/webparts/firstSpFx1/FirstSpFxWebPart.manifest.json"  

        }  

      ]  

    }  

  },  

  "externals": {},  

  "localizedResources": {  

    "FirstSpFxWebPartStrings": "lib/webparts/firstSpFx1/loc/{locale}.js"  

  }  

}


No comments:

Post a Comment