[英]How do I use `import` for npm modules in Firebase Cloud Functions?
[英]How to import firebase functions with npm?
Webpack 由于错误目前无法构建我的项目:
The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script
Webpack 不喜欢的进口很可能是这样的:
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-app.js";
import { getFirestore } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-firestore.js";
import { getAuth } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-auth.js";
import { getStorage } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-storage.js";
import { onAuthStateChanged, createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-auth.js";
如何使用 npm 或任何其他 webpack 友好的方式导入它?
你不可能只做npm i firebase
并导入这些功能吗?
还有你用的是什么框架? 可能有一个专门为您的框架量身定制的 firebase 库,例如 Angular。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.