In ReactSpa, fix HMR warning and correctly minify React for production

This commit is contained in:
SteveSandersonMS
2016-09-28 15:25:15 +01:00
parent 808592d3a0
commit 0d34dba4fd
2 changed files with 9 additions and 0 deletions

View File

@@ -10,3 +10,9 @@ export default <Route component={ Layout }>
<Route path='/counter' components={{ body: Counter }} /> <Route path='/counter' components={{ body: Counter }} />
<Route path='/fetchdata' components={{ body: FetchData }} /> <Route path='/fetchdata' components={{ body: FetchData }} />
</Route>; </Route>;
// Allow Hot Module Reloading
declare var module: any;
if (module.hot) {
module.hot.accept();
}

View File

@@ -29,6 +29,9 @@ module.exports = {
new webpack.DllPlugin({ new webpack.DllPlugin({
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'), path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]' name: '[name]_[hash]'
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': isDevBuild ? '"development"' : '"production"'
}) })
].concat(isDevBuild ? [] : [ ].concat(isDevBuild ? [] : [
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })