-2
React + Webpackを初めて使用しています。チュートリアルの一部として、私はwebpack.config.js
というファイルを書いています。Webpack dev-server予期しない識別子エラー
var webpack = require('webpack');
var path = require('path');
module.exports = {
devtool: 'inline-source-map',
entry: [
'webpack-dev-server/client?http://localhost:8080/',
'webpack/hot/only-dev-server',
'./src'
],
output: {
path: path.join(__dirname, 'public'),
filename: 'bundle.js'
},
resolve:{
moduleDirectories: ['node_modules', 'src'],
extensions: ['', '.js']
}
module:{
loaders:[
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['react-hot','babel?presets[]=react,presets[]=es2015']
}
]
},
plugins:[
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
};
私は19インチ>module:{...},
エラーの詳細行番号で予期しない識別子エラーを取得しています:これは、ファイルの内容である私はwebpack.config.js
例をチェックした
/home/adi/testcode/webpack.config.js:19
module:{
^^^^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:78:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at module.exports (/usr/lib/node_modules/webpack/bin/convert-argv.js:80:13)
at Object.<anonymous> (/usr/lib/node_modules/webpack/bin/webpack.js:39:40)
、そして見つけたものI書きましたが正しいです。それでも期待どおりには機能しません。残念ながら、私はGitHubの問題、StackOverflow、Quoraで解決策を見つけることができませんでした。
ここで私は間違いをしていますか?
恥ずかしいです:/。お手伝いありがとう :) –