swetha s
swetha s

Reputation: 43

SPFX sharepoint Deployment

i have deployed spfx to sharepoint online. firsts I have run gulp bundle --ship and again gulp package-solution --ship. I have uploaded bundle file to site assets mentioned path in manifest file. package file I have uploaded to app catalog.

now if I have to modify existing code should I again run two commands and upload files back? I see bundle files generate file name with different version name.

Upvotes: 1

Views: 377

Answers (3)

Prasanti Kintali
Prasanti Kintali

Reputation: 41

Every time we modify / add any changes , we should run both gulp bundle --ship, gulp package-solution --ship commands and deploy the .sppkg package

Upvotes: 0

Ruslan Korkin
Ruslan Korkin

Reputation: 5121

You can add "includeClientSideAssets": true" to your package-solution.json file, and you don't need to manually deploy your assets. You need just deploy .sppkg package and that's it. You can even deploy it using o365 cli from cmd. In our env I created gulp task that first modify current version and then boundle and deploy it.

includeClientSideAssets attribute was introduced in the SPFx v1.4

Upvotes: 1

Richard Li
Richard Li

Reputation: 311

That is correct from my experience.

The bundle files have a hash appended to them based on their contents, to differentiate between two versions of the script. This make it easier for browsers to get new versions when they are available. Waldek wrote a nice brief explanation about why they do this.

Note that when you upload the new package file, any pages with your web part(s) will immediately start pointing towards the new version of the bundle files. For best experience, I recommend uploading the bundle files first, then the package file, to avoid users experiencing any web part errors for that short duration if you uploaded them the other way around.

Upvotes: 1

Related Questions