2

I'm trying to update an existing spfx web part by uploading the new javascript bundled files to azure storage (using gulp --ship && gulp deploy-azure-storage).

The problem is every time it generates the bundled js, the file name has a different id appended to it. That means that my web part is still looking for the old version of the javascript.

Is there a way to have a consistent name for my web part javascript file or everytime I change something I also need to package the solution and updated it in the catalog?

Thanks

1

There is no way to update your JavaScript and keep the same production bundle filename.

The reason is that if the Framework did that, then users browser would have no way of knowing that the file has been updated and would just use the old version from the browser cache.

Waldek Mastykarz has a nice article about 5 differences between SharePoint Framework debug and release builds

| improve this answer | |
  • Thanks for the reply @Per Jakobsen. I understand the problem with the browser cache but it would be nice to have something appended to the JavaScript name other than an id. Maybe the version of the app? – Rafael Rocha Sep 8 '16 at 20:11
  • I haven't examined what they're adding, but it must be some kind of hash, because if you revert a change you get the old id back. This means that it'll only burst the cache if it's really changed. – Per Jakobsen Sep 9 '16 at 7:07
0

Every time while generating a build, the name of javascript file gets a new Id appended.

There is a way we can turn off the appending of Id to our javascript file name. In this we don't have to create a new solution every time for minor code changes.

Adding the following block of code in the gulpfile.js will not append the Id to our javascript file names.

build.copyAssets.taskConfig = {
  excludeHashFromFileNames: true
};
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.