I am trying to set up a monorepo that firebase functions will be able to require some shared logic from different directories - as for now I have a setup that works for me:
packages
├─firebase
│ ├─functions
│ │ ├─index.js -- (firebase function entry point)
│ │ └─package.json -- (name: '@functions')
│ ├─firebase.json
│ ├─.firebaserc
│ └─package.json -- (name: '@firebase')
└─front (react app inside)
├─src
├─package.json -- (name: '@front')
└─webpack.config.js
The root project package.json:
"private": true,
"workspaces": [
"apps/**",
"lib/**"
],
What I want to achieve is that I will be able to split the firebase directory like so:
├─packages
│ ├─functions -- (will require the config file from firebase workspace inside lib directory)
│ │ ├─index.js (firebase function entry point)
│ │ └─package.json
│ └─front (react app inside)
│ ├─src
│ ├─package.json
│ └─webpack.config.js
└─lib
└─firebase
├─.firebaserc
├─firebase.json
└─package.json
I tried to add to the '@functions' package.json "dependencies": "@firebase": "*"
but no luck and when I try to run the firebase emulator I get:
The functions emulator is configured but there is no functions source directory. Have you run firebase init functions?
Could not find config (firebase.json) so using defaults.
Functions package does not locate the firebase.json
and .firebaserc
?
How can I achieve packages splitting with firebase in the monorepo?