localhost 404 error when public path is set to 'dist/' in AspNetCore2 #170

Closed
opened 2025-08-09 17:15:16 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @SkeletonSkelettron on 2/16/2018

Hi
When i have set publicPath: '/' in webpack config and hit run in Visual Studio2017, browser starts up, waits for webpack until it completes project compile and then displays it. but at this configuration HMR does not work, it says 404 on *.hot-update.json

When I change to publicPath: 'dist/' in webpack config, browser starts up and stops loading page, it gives "404 localhost not found" . after webpack compiles project , then I have to manually write in browser http://localhost:1711/index.html and displays web page. at this time HMR works.

startup.cs config is:
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true, });

how can I make browser to wait for webpack compile finish?
app is Angular5 , webpack 3.11, AspNetCore2.
in case of AspNetCore1, publicPath: '/' and HMR works like charm.
thanks.

*Originally created by @SkeletonSkelettron on 2/16/2018* Hi When i have set `publicPath: '/'` in webpack config and hit run in Visual Studio2017, browser starts up, waits for webpack until it completes project compile and then displays it. but at this configuration HMR does not work, it says 404 on *.hot-update.json When I change to `publicPath: 'dist/'` in webpack config, browser starts up and stops loading page, it gives "404 localhost not found" . after webpack compiles project , then I have to manually write in browser http://localhost:1711/index.html and displays web page. at this time HMR works. startup.cs config is: ` app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true, });` how can I make browser to wait for webpack compile finish? app is Angular5 , webpack 3.11, AspNetCore2. in case of AspNetCore1, `publicPath: '/'` and HMR works like charm. thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#170
No description provided.