私はreact、redux、firebaseを統合したプロジェクトに取り組んでいます。反応を還元する - firebaseは便利なツールのようです。しかし、コードは正常に遵守されていません。以下はwebpack.config.js、.babelrc、およびindex.jsというエラーです。事前に助けてくれてありがとう。react-redux-firebase "このファイルタイプを扱うには適切なローダーが必要な場合があります。"
エラーメッセージ:
ERROR in ./~/react-redux-firebase/src/connect.js
Module parse failed:
/Users/xiqianglin/ucsdflyers/node_modules/react-redux-firebase/src/connect.js
Unexpected token (43:24) You may need an appropriate loader to handle this file type.
| }
|
| static contextTypes = {
| store: PropTypes.object.isRequired
| };
@ ./~/react-redux-firebase/src/index.js 1:0-31 @ ./src/index.js @ multi ./src/index.js
/****And there are other similar errors, all "...appropriate loader..." ***/
webpack.config.js
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
template: __dirname + '/src/index.html',
filename: 'index.html',
inject: 'body'
});
module.exports = {
entry: [
'./src/index.js'
],
module: {
loaders: [
{test: /\.js$/,
exclude: /node_modules/,
loader:'babel-loader'}
]
},
resolve: {
extensions: [".js", ".jsx", ".es6"]
},
output: {
filename: "index_bundle.js",
path: __dirname + '/dist'
},
plugins: [HTMLWebpackPluginConfig]
};
.babelrc
{
"presets": ["react", "es2015"]
}
index.js
/*Other Imports...*/
import { firebaseStateReducer } from 'react-redux-firebase'; //This is the line causing error
ReactDOM.render(
<Provider>
<App/>
</Provider>,
documeng.getElementById('app')
)
を試してみてください。あなたが提案した通りにやっても、エラーが続く – BeLikeJo
私はあなたが試すことができる別のもので私の答えを更新しました。 node_modulesフォルダをすべて除外するのではなく、 'react-redux-firebase'をインクルードする必要があるかもしれません。 –
フォローアップのコメントありがとうございます。残念ながら、私は試しても、エラーは解決しません。 – BeLikeJo