webpack配置文件如下
var webpack = require('webpack');
var path = require('path');
module.exports = {
entry: {
'index': './src/js/index'
},
output: {
path: './static/',
filename: '[name].js',
publicPath: '/static/'
},
module: {
preLoaders: [
{test: /\.jsx?$/, loader: 'eslint-loader', exclude: /node_modules/}
],
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.scss$/,
loader: 'style!css!sass?sourceMap'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
//'image?{bypassOnDebug: true, progressive:true, optimizationLevel: 3, pngquant:{quality: "65-80"}}',
'url?limit=10000&name=images/[name].[hash:8].[ext]'
]
},
{
test: /\.(woff|eot|ttf)$/i,
loader: 'url?limit=10000&name=fonts/[name].[ext]'
}
]
},
sassLoader: {
includePaths: [path.resolve(__dirname, './src/sass'), path.resolve(__dirname, './node_modules')]
},
resolve: {
extensions: ['', '.js', '.jsx']
}
};
启动webpack-dev-server(webpack-dev-server --port=9002 --inline --colors --hot)后,修改sass文件会实现热替换,但修改jsx文件就会重新刷新页面
请问配置有什么问题吗?
参考:http://segmentfault.com/a/1190000003872635。
解决方案:http://segmentfault.com/a/1190000003881087