Last checked by Netlify Support: August 2022
The following is a bit of a niche scenario that can be challenging to debug and we felt it worthy enough to capture here as a Support Guide to hopefully help any one else who encounters it. (A Big Thank you goes to one of our customers for collaborating with us to figure this one out. )
You find that a site you build from an Nx monorepo is not publishing your changes. In the Netlify UI, the Deploy Summary and within the Deploy Log for your site shows “0 new files to upload”. So why were the new changes you just saved not picked up at build time?
In Nx, there is a secondary cache location that lives outside of the dist folder located at
node_modules/.cache/nx. Adding a
--skip-nx-cache flag to the build command will allow for your changes to be picked up at build time.
A test you can perform here: in your local environment, save your changes, trigger a build, and then publish a change. If this is the problem, this exercise should demonstrate the problem as well, since your local build would also be using this cache.
This could occur for any data, but we have observed it before especially for data fetched via API during build from a third party service such as a CMS.