Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit 351fe3d

Browse files
In SpaServices, add new HotModuleReplacementEndpoint option on HMR config. Fixes #579.
1 parent 3313a7f commit 351fe3d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddleware.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ public static void UseWebpackDevMiddleware(
7878
// Ideally, this would be relative to the application's PathBase (so it could work in virtual directories)
7979
// but it's not clear that such information exists during application startup, as opposed to within the context
8080
// of a request.
81-
var hmrEndpoint = "/__webpack_hmr";
81+
var hmrEndpoint = !string.IsNullOrEmpty(options.HotModuleReplacementEndpoint)
82+
? options.HotModuleReplacementEndpoint
83+
: "/__webpack_hmr"; // Matches webpack's built-in default
8284

8385
// Tell Node to start the server hosting webpack-dev-middleware
8486
var devServerOptions = new

src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddlewareOptions.cs

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ public class WebpackDevMiddlewareOptions
1313
/// </summary>
1414
public bool HotModuleReplacement { get; set; }
1515

16+
/// <summary>
17+
/// If set, overrides the URL that Webpack's client-side code will connect to when listening for updates.
18+
/// This must be a root-relative URL similar to "/__webpack_hmr" (which is the default endpoint).
19+
/// </summary>
20+
public string HotModuleReplacementEndpoint { get; set; }
21+
1622
/// <summary>
1723
/// Overrides the internal port number that client-side HMR code will connect to.
1824
/// </summary>

0 commit comments

Comments
 (0)