Skip to content

Commit 51f45da

Browse files
committed
FIX: react-hot-loader required for actual hot-reloading
1 parent 998c7c7 commit 51f45da

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"express": "^4.11.2",
5050
"node-sass": "^3.4.2",
5151
"react": "^0.14.3",
52-
"react-dom": "^0.14.3"
52+
"react-dom": "^0.14.3",
53+
"react-hot-loader": "^1.3.0"
5354
}
5455
}

server/webpack.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ var server = new WebpackDevServer(webpack(config), {
1010
publicPath: config.output.publicPath,
1111
hot: true,
1212
stats: { colors: true },
13+
headers: { 'Access-Control-Allow-Origin': '*' }
1314
});
1415
server.listen(8080, "localhost", function() {});

webpack.config.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ var webpackConfig = {
3737
]
3838
};
3939

40+
var babelSettings = {
41+
presets: ['react', 'es2015']
42+
};
43+
4044
if (process.env.NODE_ENV === 'production') {
4145
webpackConfig = merge(webpackConfig, {
4246
entry: [
@@ -88,11 +92,8 @@ if (process.env.NODE_ENV === 'production') {
8892
loaders: [
8993
{
9094
test: /\.(js|jsx)$/,
91-
loader: 'babel',
92-
exclude: /node_modules/,
93-
query: {
94-
presets: ['react', 'es2015']
95-
}
95+
loaders: ['react-hot', 'babel?' + JSON.stringify(babelSettings)],
96+
exclude: /node_modules/
9697
},
9798
{
9899
test: /\.scss$/,

0 commit comments

Comments
 (0)