Kane Jeong
Kane Jeong

Reputation: 1

Firebase Hosting web frameworks w/ Angular, selecting environments

I am using the firebase hosting web frameworks experimental feature with an Angular ssr project. I've got everything set up correctly and everything seems to deploy fine, except I started getting a bunch of CORs errors because my staging url was not whitelisted. Then I realized that it builds and deploys using the production build pipeline by default. I couldn't find anywhere in the documentation that allows you to select an environment configuration. When normally doing a build, you can usually do something like ng build --configuration staging. However, the firebase deploy command will automatically build your project for you when you're using the web frameworks feature, and there doesn't seem to be a way to specify any parameters for your build.

TLDR running firebase deploy will build my Angular's project w/ the production configuration only with seemingly no way to change it. Is there a way to specify a configuration to use?

Upvotes: 0

Views: 276

Answers (1)

Paweł Kubiak
Paweł Kubiak

Reputation: 19

The solution could be to use the FIREBASE_FRAMEWORKS_BUILD_TARGET variable.

On MacOS: FIREBASE_FRAMEWORKS_BUILD_TARGET='staging' firebase deploy --only hosting On Windows: set FIREBASE_FRAMEWORKS_BUILD_TARGET='staging' firebase deploy --only hosting

Support for FIREBASE_FRAMEWORKS_BUILD_TARGET variable is already implemented in recent versions of the firebase-tools.

Upvotes: 0

Related Questions