1

I am facing caching issue with my Angular app. I have used several approach but issue is still there. For creating the build, I am using following command.

ng build --prod --output-hashing=all --aot

Can we add version number after hash file name like as below.

<script src='runtime.834594739.js?v=12345678'></script>

Please suggest, how to add version number with build file which auto adds in index.html file on runtime.

Thanks

3
  • The 834594739 is the hash generated by the CLI. Why do you want to add 12345678 ? Commented Sep 25, 2019 at 8:47
  • I would like to add my version number as well that's why. Commented Sep 25, 2019 at 8:48
  • stackoverflow.com/questions/39718803/… Commented Sep 25, 2019 at 8:52

1 Answer 1

0

The correct param is --outputHashing, not --output-hashing. Just focus on -- (double hyphen)

Documentation.

Angular manages that on its own, just use it correctly.

Sign up to request clarification or add additional context in comments.

2 Comments

Both will work. But after using this, my file is still being cached. After deploying the new version, we are able to see old file data.
Please share the output of your build command. If the cache busting is enabled, there is absolutely no reason for it to not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.