A script to show how the Firebase "alpha" packaging can be slimmed down, without affecting features.
The script does not make changes to your local files. It provides you the commands you need to execute yourself.
In this code, only ES modules based browser targets are left (node.js, Cordova, CommonJS removed). You can tune this by commenting out sections in the script, if you wish. The author was only interested in targeting the latest browsers (native ESM support).
Potential for size reduction:
before | after | |
---|---|---|
firebase |
18M | 216K (-98.8%) |
@firebase |
47M | 23M |
with dependencies | 80M | 55M |
I recently noticed that the node_modules/@firebase
files were 128 MB in size.That number may have been a mistake, in retrospect This script removes pieces of them, one by one, as long as my web app continues to function.
NOTE: Be prepared to restore your Firebase package, if too much gets removed.
Within one's app repo, run the script:
$ <path to>/firebase-slim.sh
Execute the listed commands - at your own risk!! - to slim.
Try, whether your app still builds and works.