diff --git a/templates/common/Gruntfile.js b/templates/common/Gruntfile.js index add91c7..36e9817 100644 --- a/templates/common/Gruntfile.js +++ b/templates/common/Gruntfile.js @@ -27,6 +27,7 @@ module.exports = function (grunt) { 'webpack-dev-server': { options: { + hot: true, port: 8000, webpack: webpackDevConfig, publicPath: '/assets/', diff --git a/templates/common/_package.json b/templates/common/_package.json index 7b1b70f..5c5a970 100644 --- a/templates/common/_package.json +++ b/templates/common/_package.json @@ -11,7 +11,8 @@ "mainOutput": "main", "dependencies": {<% if (reactRouter) { %> "react-router": "^0.7.0",<% } %> - "react": "~0.11.2" + "react": "~0.11.2", + "react-hot-loader": "^0.4.5" }, "devDependencies": { "grunt": "~0.4.5", diff --git a/templates/common/root/webpack.config.js b/templates/common/root/webpack.config.js index 1235f53..7a50f8f 100644 --- a/templates/common/root/webpack.config.js +++ b/templates/common/root/webpack.config.js @@ -6,6 +6,7 @@ */ 'use strict'; +var webpack = require('webpack'); module.exports = { @@ -17,7 +18,10 @@ module.exports = { cache: true, debug: true, devtool: false, - entry: './src/scripts/components/<%= pkg.mainInput %>.jsx', + entry: [ + 'webpack/hot/dev-server', + './src/scripts/components/<%= pkg.mainInput %>.jsx' + ], stats: { colors: true, @@ -37,7 +41,7 @@ module.exports = { loaders: [{ test: /\.jsx$/, - loader: 'jsx-loader?harmony' + loader: 'react-hot!jsx-loader?harmony' }, { test: /\.css$/, loader: 'style-loader!css-loader' @@ -45,6 +49,10 @@ module.exports = { test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' }] - } + }, + + plugins: [ + new webpack.HotModuleReplacementPlugin() + ] };