mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Beginning React+Redux "Music Store" sample
This commit is contained in:
@@ -20,8 +20,7 @@ module.exports = {
|
||||
if (enableHotModuleReplacement) {
|
||||
webpackConfig.entry.main.unshift('webpack-hot-middleware/client');
|
||||
webpackConfig.plugins.push(
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NoErrorsPlugin()
|
||||
new webpack.HotModuleReplacementPlugin()
|
||||
);
|
||||
|
||||
if (enableReactHotModuleReplacement) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.NodeServices;
|
||||
using Microsoft.AspNet.Proxy;
|
||||
using Microsoft.AspNet.SpaServices;
|
||||
@@ -52,11 +53,15 @@ namespace Microsoft.AspNet.Builder
|
||||
Port = devServerInfo.Port.ToString()
|
||||
});
|
||||
});
|
||||
|
||||
// While it would be nice to proxy the /__webpack_hmr requests too, these return an EventStream,
|
||||
// and the Microsoft.Aspnet.Proxy code doesn't handle that entirely - it throws an exception after
|
||||
// a while. So, just serve a 302 for those.
|
||||
appBuilder.Map(WebpackHotMiddlewareEndpoint, builder => {
|
||||
builder.RunProxy(new ProxyOptions {
|
||||
Host = WebpackDevMiddlewareHostname,
|
||||
Port = devServerInfo.Port.ToString()
|
||||
});
|
||||
builder.Use(next => async ctx => {
|
||||
ctx.Response.Redirect($"http://localhost:{ devServerInfo.Port.ToString() }{ WebpackHotMiddlewareEndpoint }");
|
||||
await Task.Yield();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user