我不能得到反應熱裝載機在我的項目中正常工作。當我刷新頁面時,沒有改變。我跟着這個鏈接,它似乎很簡單,但我不知道爲什麼它不工作:反應熱裝載機配置
http://gaearon.github.io/react-hot-loader/getstarted/
這裏是我的項目鏈接:
https://github.com/liondancer/ReviewWeb/blob/master/webpack.config.js
webpack.config。 JS:
var path = require('path')
var webpack = require('webpack');
// var ExtractTextPlugin = require("extract-text-webpack-plugin");
var PORT = 8080
var HOST = 'localhost';
module.exports = {
entry: [
"webpack-dev-server/client?http://" + HOST + ":" + PORT,
"webpack/hot/only-dev-server", // only prevents reload on syntax errors
'./app/index.js'
],
output: {
path: './public/js',
filename: 'main.js',
},
// devtool: 'source-map',
debug: true,
module: {
loaders: [
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.jsx$/, loaders: ['react-hot','jsx-loader'], include: path.join(__dirname, 'app') },
// { test: /\.jsx$/, loaders: 'jsx-loader' },
// http://babeljs.io/docs/usage/runtime/
{ test: /\.es6$/, exclude: /node_modules/, loader: 'babel-loader?stage=0&optional=runtime'},
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?stage=0&optional=runtime'},
{ test: /\.less$/, exclude: /node_modules/, loader: 'style-loader!css-loader!less-loader'},
{ test: /\.css$/, exclude: /node_modules/, loader: 'style-loader!css-loader' }
// { test: /\.less$/, exclude: /node_modules/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader") }
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
// https://github.com/webpack/extract-text-webpack-plugin#usage-example-with-css
// new ExtractTextPlugin('style.css', {
// allChunks: true
// })
// this will look through all your entry points and find any files that are common
// or find dependencies that are common throughout the node_modules and extract them and
// put them into one file called common.js or whatever you want to call it.
// used to reduce file size when served.
new webpack.optimize.CommonsChunkPlugin('common.js')
]
};
你有沒有看過['react-hot-boilerplate'](https://github.com/gaearon/react-hot-boilerplate)? – katranci