1.0.9 • Published 4 years ago
firebase-functions-cache v1.0.9
Firebase Cache Repro WIP
About
By default, firebase does not generate cache files for functions. As a result, running firebase deploy
causes all functions to be re-deployed regardless if they were modified or not.
Solution
We can use webpack to bundle all the functions from the index.js
file into a single bundle.js
file. From there, we can run a script that creates hashes of all of the named functions using https://www.npmjs.com/package/object-hash
.
Then we can save these hashes and commit them back to the repo. In our CI, we can check if hashes have changed and deploy using the --only
flag for modified functions.
Reference
I am replicating the solution suggested by https://stackoverflow.com/a/58380228 last year with a code implementation.