我使用Webpack构建我的React项目,但我遇到了问题。 当我删除构建文件夹并让webpack再次构建它时,我的代码可以工作,但是当webpack由于watch选项重建它时,它不起作用。我在JS控制台中收到了这些错误:
这是我的webpack配置文件:
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require('webpack');
module.exports = [{
entry: './src/app/App.jsx',
output: {
path: __dirname,
filename: 'build/app.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('css!sass')
}
]
},
plugins: [
new ExtractTextPlugin('build/style.css', {
allChunks: true
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
],
watchOptions: {
poll: 1000
}
}];