In SpaServices, add new HotModuleReplacementEndpoint option on HMR config. Fixes #579.

This commit is contained in:
SteveSandersonMS
2017-01-20 15:03:52 +00:00
parent 3313a7f0a6
commit 351fe3d15c
2 changed files with 9 additions and 1 deletions

View File

@@ -78,7 +78,9 @@ namespace Microsoft.AspNetCore.Builder
// Ideally, this would be relative to the application's PathBase (so it could work in virtual directories) // Ideally, this would be relative to the application's PathBase (so it could work in virtual directories)
// but it's not clear that such information exists during application startup, as opposed to within the context // but it's not clear that such information exists during application startup, as opposed to within the context
// of a request. // of a request.
var hmrEndpoint = "/__webpack_hmr"; var hmrEndpoint = !string.IsNullOrEmpty(options.HotModuleReplacementEndpoint)
? options.HotModuleReplacementEndpoint
: "/__webpack_hmr"; // Matches webpack's built-in default
// Tell Node to start the server hosting webpack-dev-middleware // Tell Node to start the server hosting webpack-dev-middleware
var devServerOptions = new var devServerOptions = new

View File

@@ -13,6 +13,12 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
/// </summary> /// </summary>
public bool HotModuleReplacement { get; set; } public bool HotModuleReplacement { get; set; }
/// <summary>
/// If set, overrides the URL that Webpack's client-side code will connect to when listening for updates.
/// This must be a root-relative URL similar to "/__webpack_hmr" (which is the default endpoint).
/// </summary>
public string HotModuleReplacementEndpoint { get; set; }
/// <summary> /// <summary>
/// Overrides the internal port number that client-side HMR code will connect to. /// Overrides the internal port number that client-side HMR code will connect to.
/// </summary> /// </summary>