re-base
を使用して、Reactを使用してFirebaseアプリに接続しようとしています。私の問題は私のアプリが構築されている場合ということですFirebase Webのインポートが定義されていません
import React from 'react';
import Firebase from 'firebase';
const base = new Firebase('https://my-firebase-app.firebaseio.com');
export default class Home extends React.Component {
constructor(props) {
super(props);
this.state = {
data: {}
};
}
componentDidMount() {
this.ref = base.syncState('coffees', {
context: this,
asArray: true,
state: 'coffees',
then:() => {
console.log('finished base.syncState')
}
});
...
}
componentWillUnmount(){
base.removeBinding(this.ref);
}
render() {
...
}
}
、私はこれらの線の近くに、Firebase APIで'n' is undefined
を取得しています:
};function Fa() {
return Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random())^ja()).toString(36);
};var w;a: {
var Ga = n.navigator;if (Ga) {
var Ha = Ga.userAgent;if (Ha) {
w = Ha;break a;
}
}w = "";
};function Ia() {
ここ
は、コンポーネントがどのように見えるリアクト私のものですconst base='...'
行をコメントアウトしても、エラーはスローされます。 A:Firebase APIファイルに何か問題があります B:Babel/Webpackは、そうしてはならないものをマングリングしています。しかし、webpackのBabelローダーをcompact: false
に設定しようとしましたが、無駄です。
最後に、ここで私のpackage.jsonを見てです:
"dependencies": {
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-router": "^2.0.1"
},
"devDependencies": {
"babel-core": "^6.7.2",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"eslint": "^2.4.0",
"eslint-plugin-react": "^4.2.3",
"html-webpack-plugin": "^2.10.0",
"re-base": "^1.5.1",
"webpack": "^1.12.14",
"webpack-dev-server": "^1.14.1"
}
、これは全体のアプリは、私は、デバッグを開始する見当がつかないロード&を失敗するので、私はこだわっています。どんな洞察も素晴らしいだろう!
クロス投稿:https://groups.google.com/forum/#!topic/firebase-talk/vPztQKZQHC0 –