1
votes

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.

2

2 Answers

1
votes

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.

1
votes

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