Property 'firebase' does not exist on type { production: boolean; }
When you run ng build --prod
angular-cli will use the environment.prod.ts
file and your environment.prod.ts
files environment
variable doesn't have the firebase
field hence you are getting the exception.
Add the field to
environment.prod.ts
export const environment = {
production: true,
firebase: {
apiKey: '...',
authDomain: 'project.firebaseapp.com',
databaseURL: 'https://project.firebaseio.com',
projectId: 'project',
storageBucket: 'project.appspot.com',
messagingSenderId: '...',
},
};
My approach is to merge common environment object with prod one. Here's my environment.prod.ts:
import { environment as common } from './environment';
export const environment = {
...common,
production: true
};
So common environment object acts as an overridable default for all other environments.