X Tutup
Skip to content

Commit e59e2e0

Browse files
Only use Webpack Dev Middleware in dev mode
1 parent 8ef9ab3 commit e59e2e0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

samples/react/ReactGrid/Startup.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,14 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
5353
app.UseExceptionHandler("/Home/Error");
5454
}
5555

56-
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
57-
HotModuleReplacement = true,
58-
ReactHotModuleReplacement = true
59-
});
56+
// In dev mode, the JS/TS/etc is compiled and served dynamically and supports hot replacement.
57+
// In production, we assume you've used webpack to emit the prebuilt content to disk.
58+
if (env.IsDevelopment()) {
59+
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
60+
HotModuleReplacement = true,
61+
ReactHotModuleReplacement = true
62+
});
63+
}
6064

6165
// Add static files to the request pipeline.
6266
app.UseStaticFiles();

0 commit comments

Comments
 (0)
X Tutup