Warning “It looks like you're using the development build of the Firebase JS SDK” in Angular firebase app

流过昼夜 提交于 2021-01-29 20:32:14

问题


I'm using angular fire sdk in my angular project. But it trigger following warning. I searched about this problem and get answers. But those answers cannot apply to angular project.

It looks like you're using the development build of the Firebase JS SDK.
When deploying Firebase apps to production, it is advisable to only import
the individual SDK components you intend to use.

For the module builds, these are available in the following manner
(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):

CommonJS Modules:
const firebase = require('firebase/app');
require('firebase/<PACKAGE>');

ES Modules:
import firebase from 'firebase/app';
import 'firebase/<PACKAGE>';

Typescript:
import * as firebase from 'firebase/app';
import 'firebase/<PACKAGE>';
  • Warning: It looks like you're using the development build of the Firebase JS SDK
  • How to stop the warning: It looks like you're using the development build of the Firebase JS SDK?
  • Firebase JS SDK warning while load application in browser (angular v5)
  • How to avoid Firebase warning that I’m using the development build?

My app module looks like this.

import {AngularFireModule} from '@angular/fire';
import {AngularFireAuthModule} from '@angular/fire/auth';

imports:[
   ...
    AngularFireModule.initializeApp(environment.firebaseConfig),
    AngularFireAuthModule,
]

I want to stop this warning in my angular project.


回答1:


Finally i found a solution.

This is Wrong Way to import firebase

import {auth} from 'firebase';

And This is Correct Way to import firebase

import * as firebase from 'firebase/app';


来源:https://stackoverflow.com/questions/62219946/warning-it-looks-like-youre-using-the-development-build-of-the-firebase-js-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!