I am totally new in React Js. Currently I need to auto update the version number whenever I build so that the browser can automatically reload the JS/CSS files without having to clear the cache manually. Is there any way to do this? I searched but most of it is for .net answers. Really appreciate any guidance and helps..Thank you
Asked
Active
Viewed 1,188 times
2 Answers
1
Looks like you can easily do this with a small NPM package that is already pre-built
https://richhewlett.com/2020/07/11/auto-increment-build-number-in-a-javascript-app/

James White
- 43
- 1
- 6
-
thanks, let me try and will let you know :) – user3431310 May 17 '21 at 04:58
-
my generate-buildno.js is not getting called.. for now i simply put alert message, but it is not called.. – user3431310 May 17 '21 at 06:41
0
There is also an npm package named auto-version-js
which allows you to automatically increase your version number :
npx auto-version --patch # +0.0.1
npx auto-version --minor # +0.1.0
npx auto-version --major # +1.0.0
To implement it in your package.json
file :
"scripts": {
"dev:patch": "npx auto-version --patch",
"dev:minor": "npx auto-version --minor",
"dev:major": "npx auto-version --major"
}
The documentation is available here.

Dorian B
- 108
- 10