Deployed my test app to firebase-hosting.
Clicking sign-up/sign-in button calls 'signInWithPopup(auth, provider)'
;
Popup window shows: “This site can’t be reached. 127.0.0.1 refused to connect.”
I assume the reason for the error is the environment was not changed during the “build”.
provideFirebaseApp(() => initializeApp(environment.firebaseConfig)),
provideAuth(() => {
const auth = getAuth();
if (environment.useEmulators) {
connectAuthEmulator(auth, 'http://127.0.0.1:9099');
}
return auth;
}),
We used to have “angular filereplacements” in Angular applications.
QUESTION: How do I replace environment config for Angular app in Nx monorepo?
The project.json file for the Angular app:
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:application",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/qubitme",
"index": "apps/qubitme/src/index.html",
...
},
"configurations": {
"production": {
...
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
4
Here is how i managed replacing env files within NX monorepo + Angular app:
project.json
"build": {
"executor": "@angular-devkit/build-angular:application",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/ngsf",
"index": "apps/ngsf/src/index.html",
"browser": "apps/ngsf/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/ngsf/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["apps/ngsf/src/assets"],
"styles": [
"apps/ngsf/src/styles.scss",
"@angular/material/prebuilt-themes/indigo-pink.css",
"apps/ngsf/src/assets/styles/splash-screen.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "1mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "libs/common/ui-common/src/environments/environment.ts",
"with": "libs/common/ui-common/src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
Hope it works for you!
1