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 CDN builds, these are available in the following manner
(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):
https://www.gstatic.com/firebasejs/5.0.0/firebase-<PACKAGE>.js
它占用了我已经有限的控制台空间的一半:(
注意:我在html中使用firebase。使用脚本标记。我没有使用这里解释的导入语法:similar question
如何停止此警告?
发布于 2018-06-13 12:33:07
您的错误消息将告诉您如何修复它...这部分就在这里:
For the CDN builds, these are available in the following manner
(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):
https://www.gstatic.com/firebasejs/5.0.0/firebase-<PACKAGE>.js
因此,如果您使用的是Firebase身份验证,那么您应该有一个脚本标记来请求https://www.gstatic.com/firebasejs/5.0.0/firebase-auth.js
...对于Firebase数据库,您还可以使用另一个脚本标记https://www.gstatic.com/firebasejs/5.0.0/firebase-database.js
...对于Firebase的任何其他部分,只需遵循该模式。
发布于 2018-08-20 19:34:17
为了更清楚地回答这个问题,
你最有可能得到的是
<script src="https://www.gstatic.com/firebasejs/6.0.2/firebase.js"></script>
因为这是Firebase在"Add Firebase to your web app“屏幕上提供给你的。
但是,它所做的是导入所有Firebase模块。我不知道为什么Firebase会把这个作为生成的脚本,但你需要做的就是将-app添加到源代码中,这样它就是现在的。
<script src="https://www.gstatic.com/firebasejs/6.0.2/firebase-app.js"></script>
然后,对于您想要使用的Firebase的每个后续功能,您将需要添加另一个脚本行。例如,如果您想将云消息添加到您的web应用程序中,它只需要。
<script src="https://www.gstatic.com/firebasejs/6.0.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.0.2/firebase-messaging.js"></script>
您可以找到更多信息,包括导入here from Firebase.的完整列表
发布于 2019-03-10 07:15:14
给出here的细节并不是很容易理解:
步骤1:删除下面的代码行,因为它是开发版本:
<script src="https://www.gstatic.com/firebasejs/5.8.6/firebase.js"></script>
第2步:添加以下行,(必需),生产版本:
<script src="https://www.gstatic.com/firebasejs/5.8.6/firebase-app.js"></script>
步骤3:添加您需要的更多包/服务,如数据库、(可选)、生产版本:
<script src="https://www.gstatic.com/firebasejs/5.8.6/firebase-database.js"></script>
这就解决了问题。
https://stackoverflow.com/questions/50834092
复制相似问题