LoginSignup
3
0

More than 5 years have passed since last update.

ERROR in src/app/app.module.ts(80,49): error TS2339: Property 'firebase' does not exist on type '{ production: boolean; }'.

Posted at

【備忘録】


Angular7を以下のコマンドでプロダクションビルドして出たエラー

C:\projects\projectA>ng build --prod --output-path=dist


エラー内容:

ERROR in src/app/app.module.ts(80,49): error TS2339: Property 'firebase' does not exist on type '{ production: boolean; }'.


対処法

とても簡単で、ng build --prod コマンドではangular-cliはenvironment.prod.tsファイルを使用する。
environment.tsではなくて。

なのでenvironment.prod.tsファイルにもenvironment.tsと同じようにfirebaseで使う環境変数を入力してあげればよい。

environment.prod.ts
export const environment = {
  production: true,
    // Initialize Firebase
    firebase : {
      apiKey: "<****>",
      authDomain: "<****>.firebaseapp.com",
      databaseURL: "https://<****>.firebaseio.com",
      projectId: "<****>",
      storageBucket: "<****>.appspot.com",
      messagingSenderId: "<****>"
    }
};

以上

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0