angular - 从 Angular 6 更新开始,从 'firebase' 导入 * 作为 firebase 不再有效

标签 angular firebase import angular6

我最近将我的 Angular 5 项目更新为 Angular 6,并且我一整天都在尝试构建和部署。我的最新问题是导入问题 - 之前工作正常。

错误现在显示 cannot find module 'firebase'在我的导入中。

cannot find module 'firebase'

最佳答案

对于 Angular 6+,按如下方式导入 firebase 核心和服务:

/*
* reduce the amount of code that your app uses by 
* only including the features that you need.
*/

// import core firebase client (required)
import firebase from '@firebase/app';

// import Firebase Authentication (optional)
import '@firebase/auth';

// import Firebase Realtime Database (optional)
import '@firebase/database';

// import Cloud Firestore (optional)
import '@firebase/firestore';

Selenium official docs想要查询更多的信息。

关于angular - 从 Angular 6 更新开始,从 'firebase' 导入 * 作为 firebase 不再有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51470126/

相关文章:

ember.js - 使用 Firebase Simple Login 保护路由

firebase - 将文件上传到 Firebase 云存储时出错 : "Listing objects in a bucket is disallowed for rules_version = 1"

java,有没有办法我们可以用另一个名字导入一个类

Python 2.7 运行时代码更改

javascript - 将多个选定选项传递给 Angular 中的 Firebase 查询(AngularFire2)

angular - 如何处理本地文件夹中不存在的错误图像

javascript - Angular Ionic @ViewChild 失去引用

javascript - Firebase 事务错误 : [Error: Set]

javascript - 如何在 react 页面上正确显示带有对象(来自另一个文件)的数组?

jquery - 如何使用 Angular 6 安装 bootstrap 4 + jquery + popper.js