私はこのプロジェクトでwebpackを使用して反応し、私のプロジェクトにreact-paginator
をインポートしたいのですが、フロントエンドコードをバンドルするとエラーが発生します。Webpack予期しないトークン<
私はWebPACKのはnode_modules
フォルダの下にJSXコードを解析していなかったと思いますが、私は解決するためにどのように何のアイデアを持っていない......
エラー:
ERROR in ./~/react-paginator/index.js
Module parse failed: /home/kang/Desktop/doing/match-platform/node_modules/react-paginator/index.js Line 109: Unexpected token <
You may need an appropriate loader to handle this file type.
ウェブパック設定:
var webpack = require('webpack');
module.exports = {
entry: {
root: './src/front_end/scripts/root_container.js',
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets:['es2015', 'react']
}
}, {
test: /\.json$/,
loader: 'json'
}]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
output: {
path: './src/front_end/dist',
publicPath: '/',
filename: 'bundle.js'
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
'root.jQuery': 'jquery',
'Promise': 'exports?global.Promise!es6-promise',
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch',
}),
new webpack.DefinePlugin({
"require.specified": "require.resolve"
}),
]
};
私は 'include:path.join(__ dirname、 'node_modules/react-paginator')'を追加すると新しいエラーになるので、代わりに 'react-pagify'を使用します。 ありがとうございます。 – jacky810124