DEV Community

Discussion on: Clear Cache on build for React Apps.

Collapse
 
khorengrig profile image
khorengrig

Who can explain me what is going in this file. update-build.js. Every time you run build command your package.json buildDate and meta.json buildDate will be the same(You are inserting the same value). Which way this code will work?

Collapse
 
ammartinwala52 profile image
Ammar Tinwala

Hi Khorengrig

Im very sorry for this very very late reply.
Both dates are generated at the same time, and when you generate your build and deploy, at that point of time the api call from meta.json will fetch the latest build date and it will be compared with package.json date. If package.json date is cached it will be a mismatch and then only the refresh will happen. If your server/deployment configuration is such that it always takes the latest build then your package.json buildDate and meta.json buildDate will always be the same.
I hope you got the point.