webpack-dev-server: hot-update.json 404 (Not Found)
Reproducible test repos:
Shortly: publichPath in webpack-dev-server doesn’t override publisPath in webpack
Need search way how better handle publicPath
https://github.com/webpack/webpack-dev-server/issues/1591#issuecomment-468081433
https://github.com/webpack/webpack-dev-server/issues/1591#issuecomment-448995873
- Operating System: El Capitan 10.11.6
- Node Version: 8.9.3
- NPM Version: 5.5.1
- webpack Version: 4.6.0
- webpack-dev-server Version: 3.1.3
- This is a bug
- This is a modification request
Code
const path = require('path');
const fs = require("fs");
const dir = d => path.join(process.cwd(), d);
module.exports = {
entry: {
application: './src/application',
test: './src/test'
},
output: {
path: dir('../public/assets/client'),
filename: "[name].bundle.js"
},
devServer: {
stats: 'errors-only',
https: true,
key: './path_to_pemfile.pem',
cert: './path_to_pemfile.pem',
headers: {
'Access-Control-Allow-Origin': '*'
},
port: 9092,
host: 'broker-gateway-webpack.firstbanco.dev'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
"scripts": {
"start": "webpack-dev-server --hot --mode development"
}
Expected Behavior
I would expect HMR to work.
Actual Behavior
When I save a change in a js file a request is made for application.bundle.js:33 GET https://broker-gateway.firstbanco.dev/1a00a5ecc216afcb2106.hot-update.json 404 (Not Found).
As you can see the correct port number has not been specified for the requested resource.
If I manually execute a GET request to https://brokergateway.firstbanco.dev:9092/1a00a5ecc216afcb2106.hot-update.json (note I have added correct port) then I get the resource fine.
For Bugs; How can we reproduce the behavior?
As explained… use above webpack config and change a js file under application or test entry points.
For Features; What is the motivation and/or use-case for the feature?
Ease of development.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 22
- Comments: 41 (13 by maintainers)
PR welcome
@josh08h how about this?
We have to change the port which provides hot-update from 8080 to 9000 even if we access
localhost:8080.set a publicPath in your ‘output’ and ‘devserver’ which is the URL of output.path from the view of the HTML page.
try
maybe useful
I’d just like to second that I believe am running into this problem(or a similar one) as well. My webpack config is as follows:
When using hotOnly: true, the hotupdate is using localhost:22850 and 404’s, but if I manually make the get request using localhost:8080 I receive a response.
While this is not at all a solution to the issue, if you just want to hack your way around it to get the
hot-update.jsonworking again - this is what I did. My issue was that I am running my (vue) devServer on a different port (and url) as I want to run it underhttps.What I did was to simply edit the
node_modules/webpack/lib/web/JsonpMainTemplate.runtime.jsfile manually. Horrible, but it works for me 😉 . I’m showing the methods here, but, to be clear I only edited this line and this line.In the hotDownloadUpdateChunk I just fixed the
srcattribute manually.And similarly in the
hotDownloadManifestmethod.yep, it is bug, need search way how we can solve this without breaking
Mid-September 2020
FWIW something about Chrome’s recent update has been broken a few things for me, and this is a new issue for us. We were able to get everything working again by restarting the browser.
@evilebottnawi Here: https://github.com/Loonride/webpack-issue-repro
I have solved the issue here: https://github.com/webpack/webpack-dev-server/pull/2055. It is on
nextbecause there are potential breaking changes.Somebody can create minimum reproducible test repo?
Invalid configuration, please create minimum reproducible test repo
I’m actually getting this same error but everything seems to be served from the right url and the file is available on the server side. It just ends up with a 404, does anyone else have this issue? My app is running on a docker container if that is relevant
Reproducible repo: https://github.com/krzystof/webpack-issue-repro
Duplicate https://github.com/webpack/webpack-dev-server/issues/1785?