Skip to content

Commit d6ae882

Browse files
In HMR, don't rely on default JsonSerializer settings. Fixes aspnet#688
1 parent a94ac6f commit d6ae882

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ public static class WebpackDevMiddleware
1515
{
1616
private const string DefaultConfigFile = "webpack.config.js";
1717

18+
private static readonly JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings
19+
{
20+
ContractResolver = new CamelCasePropertyNamesContractResolver(),
21+
TypeNameHandling = TypeNameHandling.None
22+
};
23+
1824
/// <summary>
1925
/// Enables Webpack dev middleware support. This hosts an instance of the Webpack compiler in memory
2026
/// in your application so that you can always serve up-to-date Webpack-built resources without having
@@ -88,7 +94,7 @@ public static void UseWebpackDevMiddleware(
8894
};
8995
var devServerInfo =
9096
nodeServices.InvokeExportAsync<WebpackDevServerInfo>(nodeScript.FileName, "createWebpackDevServer",
91-
JsonConvert.SerializeObject(devServerOptions, new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() })).Result;
97+
JsonConvert.SerializeObject(devServerOptions, jsonSerializerSettings)).Result;
9298

9399
// If we're talking to an older version of aspnet-webpack, it will return only a single PublicPath,
94100
// not an array of PublicPaths. Handle that scenario.

0 commit comments

Comments
 (0)