Merge pull request #38 from muffinresearch/fix-hmr

Fix HMR
This commit is contained in:
Stuart Colville 2016-02-25 17:02:30 +00:00
Родитель d13f5a934f c56c376192
Коммит fe6c5b5111
3 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -35,7 +35,10 @@
"babel-core": "6.5.2",
"babel-eslint": "5.0.0",
"babel-loader": "6.2.3",
"babel-plugin-react-transform": "2.0.0",
"babel-plugin-transform-class-properties": "6.5.2",
"babel-plugin-transform-decorators-legacy": "1.3.4",
"babel-plugin-transform-object-rest-spread": "6.5.0",
"babel-preset-es2015": "6.5.0",
"babel-preset-react": "6.5.0",
"babel-preset-stage-2": "6.5.0",
@ -47,6 +50,7 @@
"history": "2.0.0",
"react-dom": "0.14.7",
"react-hot-loader": "1.3.0",
"react-transform-hmr": "1.0.2",
"semver": "5.1.0",
"shelljs": "0.6.0",
"webpack": "1.12.14",

Просмотреть файл

@ -45,6 +45,7 @@ export default function(routes) {
}));
if (ENV === 'development') {
console.log('Adding Webpack Dev Server'); // eslint-disable-line no-console
devServer(app);
}

Просмотреть файл

@ -7,6 +7,22 @@ import config from 'config';
const APP_NAME = config.get('currentApp');
const BABEL_QUERY = {
presets: ['react', 'es2015'],
plugins: [
['transform-object-rest-spread'],
['transform-class-properties'],
['transform-decorators-legacy'],
['react-transform', {
transforms: [{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module'],
}],
}],
],
};
export default function(app) {
const conf = Object.assign(webpackConfig, {
devtool: 'inline-source-map',
@ -14,6 +30,14 @@ export default function(app) {
'webpack-hot-middleware/client',
`./src/${APP_NAME}/client`,
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: BABEL_QUERY,
}],
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),