I've got a Firebase project with file structure like so:
node_modules/
package.json
functions/
node_modules/
package.json
If I npm install firebase
in the parent project, everything works fine locally but the code fails on deployment because the child project is deployed without the parent project yet depends on Firebase.
If I install Firebase in the child project, the parent app complains "Cannot find module 'firebase/storage'"
If I install Firebase in both projects, the parent app complains "Cannot read 'path' of undefined"
- debugging shows this is a Firebase internal error.
My ideal solution is to npm install firebase
in the child project only, but somehow allow the parent project to access it? Is this possible?
I've read about npm-link but not sure if this can help me or whether there is some other more suitable solution.
Optional reading: Why do I have a structure like this?
I ended up with this structure because the child project is a Firebase project and firebase init
created the functions folder and its contents. The child project is deployed to Google Cloud.
The parent project is a simple test bed app that I created and uses much of the code in the child project for testing purposes only, this code is not deployed.