Monorepo Issue: Multiple Angular Projects Using a Shared Firebase Auth Service
I have a monorepo with the following structure: firebase (Holds authentication logic and shared services) admin (Angular app) client (Angular app) All projects are on Angular v19. The firebase project is an Angular app but serves as a shared library for admin and client. This setup allows me to import shared logic easily, as seen in my tsconfig.base.json (https://i.sstatic.net/bZyRcYLU.png) and app.component (https://i.sstatic.net/KncZOUlG.png) . The authentication service in firebase is structured like this: Auth Service Code (https://i.sstatic.net/LhHj8FDd.png). Everything works perfectly in development—admin and client function without needing to start firebase as a standalone app. Now, I want to deploy both admin and client on Firebase Hosting. I followed the Firebase documentation, built my projects with nx build, and initialized Firebase Hosting in the dist directory. The build completed successfully, but upon visiting the deployed app, I encountered unexpected errors that weren't present during development. Build Output (https://i.sstatic.net/Da5xsVU4.png) Development (Works as Expected) (https://i.sstatic.net/MBVI2RYp.png) Production Error (https://i.sstatic.net/CeYFdOrk.png) Any insights on what could be causing these production issues? What have I tried? I built the admin and client apps using nx build, then initialized Firebase Hosting in the dist directory. I expected both apps to work as they did in development. However, after deployment, I encountered errors that weren’t present locally.
I have a monorepo with the following structure:
firebase (Holds authentication logic and shared services)
admin (Angular app)
client (Angular app)
All projects are on Angular v19. The firebase project is an Angular app but serves as a shared library for admin and client. This setup allows me to import shared logic easily, as seen in my tsconfig.base.json (https://i.sstatic.net/bZyRcYLU.png) and app.component (https://i.sstatic.net/KncZOUlG.png) .
The authentication service in firebase is structured like this: Auth Service Code (https://i.sstatic.net/LhHj8FDd.png). Everything works perfectly in development—admin and client function without needing to start firebase as a standalone app.
Now, I want to deploy both admin and client on Firebase Hosting. I followed the Firebase documentation, built my projects with nx build, and initialized Firebase Hosting in the dist directory. The build completed successfully, but upon visiting the deployed app, I encountered unexpected errors that weren't present during development.
Build Output (https://i.sstatic.net/Da5xsVU4.png)
Development (Works as Expected) (https://i.sstatic.net/MBVI2RYp.png)
Production Error (https://i.sstatic.net/CeYFdOrk.png)
Any insights on what could be causing these production issues?
What have I tried?
I built the admin and client apps using nx build, then initialized Firebase Hosting in the dist directory. I expected both apps to work as they did in development. However, after deployment, I encountered errors that weren’t present locally.