Cloudflare is rebuilding node_modules in every bui...
# pages-help
m
Cloudflare isn't caching the
node_modules
folder so that consequents build run faster. I see the message
Started restoring cached node modules
and
Finished restoring cached node modules
messages on the top of all the deployment logs. But it's not working actually.
npm
used to reinstall and download all the dependencies every time. Now, I am using
pnpm
, and the pnpm store is set to
node_modules/.pnpm-store
but it's redownloading and installing all the dependencies every time. I am also using
astro-imagetools
which stores its cache inside
node_modules/.cache/astro-imagetools
which is also not working. And it's heavily impacting the build time. I have tested both retrying deployments, adding a new commit, and triggering the deploy hooks. But none of them is able to restore the
node_modules
.
h
No idea why it is logging that, but the current implementation doesn't share any state between builds, so it shouldn't be able to cache dependencies at all
m
Oo... Is it on the roadmap??
Or @HardAtWork, is there any directory (maybe a system directory) that is persistent and accessibel too??
h
There is not. You can do it manually by syncing with an external storage system, but when a build is completed, everything is wiped
Or use GH Actions
m
GH Actions to do what??
h
Build your project in GH Actions(which should be able to cache dependencies), and then deploy to Pages. Instead of using Pages CI
m
Yeah, I got that but it is possible to deploy to Pages programmatically?!
I didn't know that
m
Thanks!
HI đź‘‹ @HardAtWork ! If I build the website using GitHub actons and then deploy the built directory to Cloudflare, then what's the best way to rebuild the website on CMS update??