我正在使用WebPack和firebase。 Webpack的主要文件(app.js)如下所示:
import "./sass/style.scss";
import "./js/firebase.js";
import firebase from 'firebase';
import database from "firebase/database";
import auth from "firebase/auth";
import "./js/firebase.js";
import "./js/utils.js";
import "./js/auth.js";
import "./js/forms.js";
import "./js/listRequests.js";
import "./js/picturefill.js";
所以,我的“ firebase.js”看起来像这样:
var firebaseConfig = {
apiKey: "something",
authDomain: "something",
databaseURL: "something",
projectId: "something",
storageBucket: "something",
messagingSenderId: "something",
appId: "something"
};
firebase.initializeApp(firebaseConfig);
let ref = database.ref("something");
我专门将所有值都检查了某种东西,不用担心。 我在附加“ bundle.js”(webpack的主文件)的每个页面上看到的是
firebase is not defined
at Object.<anonymous> (bundle.js:667)
at n (bundle.js:1)
at Module.<anonymous> (bundle.js:2760)
at n (bundle.js:1)
at bundle.js:1
at bundle.js:1
所以我只想知道,这是什么问题?请你帮助我好吗?我是webpack和firebase的新手。谢谢!