Skip to content

Commit 0d34dba

Browse files
In ReactSpa, fix HMR warning and correctly minify React for production
1 parent 808592d commit 0d34dba

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

templates/ReactSpa/ClientApp/routes.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ export default <Route component={ Layout }>
1010
<Route path='/counter' components={{ body: Counter }} />
1111
<Route path='/fetchdata' components={{ body: FetchData }} />
1212
</Route>;
13+
14+
// Allow Hot Module Reloading
15+
declare var module: any;
16+
if (module.hot) {
17+
module.hot.accept();
18+
}

templates/ReactSpa/webpack.config.vendor.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ module.exports = {
2929
new webpack.DllPlugin({
3030
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
3131
name: '[name]_[hash]'
32+
}),
33+
new webpack.DefinePlugin({
34+
'process.env.NODE_ENV': isDevBuild ? '"development"' : '"production"'
3235
})
3336
].concat(isDevBuild ? [] : [
3437
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })

0 commit comments

Comments
 (0)