New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hot-update.json 404 (Not Found) #1385
Comments
Looks |
PR welcome |
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: const webpack = require('webpack');
const path = require('path');
const proxy = 'localhost:22850/clients/dev/default.aspx/'
module.exports = {
entry: [
'react-hot-loader/patch',
'./components/App.js',
'./css/main.scss'
],
mode: 'development',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.(scss|sass|css|)$/,
use: [
'style-loader',
"css-loader",
"sass-loader"
]
},
{
test: /\.(jpe?g|png|gif|woff|woff2|eot|ttf|svg)(\?[a-z0-9=.]+)?$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
fallback: 'file-loader',
relativePathName: true,
publicPath: 'http://localhost:8080/'
}
}
]
}
]
},
resolve: {
extensions: ['*', '.js', '.jsx', '.png', '.woff', '.woff2']
},
output: {
path: path.resolve(__dirname, '/dist'),
filename: 'bundle.js',
publicPath: '/'
},
devtool: 'source-map',
devServer: {
// https://stackoverflow.com/questions/43544077/react-with-typescript-hot-reload-iis-webserver
proxy: {
'*' : {
target: 'http://' + proxy
}
},
port: 8080,
host: '0.0.0.0',
publicPath: 'http://localhost:8080',
hot: true,
headers: {'Access-Control-Allow-Origin': '*'}
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
node: {
console: true // needed for html5-history package
} 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. |
I am observing the same issue although the server responds with a 200 okay response and serves an html file. |
Suddenly got this issue as well. Seems to have happened after some change I did while developing caused the dev server update to fail, after which it started serving successful updates from the wrong port number (the one used for serving the site, not the default port 8080). |
Anything happening on this one? Started a different project and have updated to all the lastest webpack packages and still having this problem... |
Invalid configuration, please create minimum reproducible test repo |
I also get the page to serve setting the port manually with say |
set a publicPath in your 'output' and 'devserver' which is the URL of output.path from the view of the HTML page. |
Duplicate #1785? |
Somebody can create minimum reproducible test repo? |
@evilebottnawi This seems to be a combination of 2 problems, as I fully explain here: https://github.com/Loonride/webpack-issue-repro
EDIT: the problem is here - https://github.com/webpack/webpack/blob/master/lib/web/JsonpMainTemplate.runtime.js#L31 |
@josh08h how about this? const path = require('path')
module.exports = {
mode: 'development',
entry: path.join(__dirname, 'bundle.js'),
+ output: {
+ publicPath: 'http://0.0.0.0:9000/dist/',
+ },
devServer: {
contentBase: __dirname,
- publicPath: '/dist/',
compress: true,
port: 9000,
hotOnly: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
}
} We have to change the port which provides hot-update from 8080 to 9000 even if we access |
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 |
It works!Thanks! |
test it:
|
I was having this same issue using dev-server with Electron. The fix @josh08h posted worked like a charm. |
Somebody can create minimum reproducible test repo? |
@evilebottnawi Here: https://github.com/Loonride/webpack-issue-repro I have solved the issue here: #2055. It is on |
Also noticing the issue when proxying the connection via a docker/envoy container. |
For me the problem was that the |
for me, the main weird thing is that it works when my hotUpdateMainFilename is without [hash], but when I put [hash] on filename, 404 all the time. |
I think I may have found the issue.. not sure if its the same. I only found that hot module loading worked on Some experimenting later I found line 40: // script.src = $require$.p + $hotChunkFilename$;
script.src = window.location.origin + '/' + $hotChunkFilename$; line 24. I swapped // script.src = $require$.p + $hotChunkFilename$;
script.src = window.location.origin + '/' + $hotChunkFilename$; I want to prepare this for a PR but can anyone advise if I'm fixing this correctly and what is |
I had encountered with this issue. but the big problem was it's consequence. Infinite reloading page again and again.
|
try devServer: {
host: '0.0.0.0', port: 8080,
public: '0.0.0.0:8080',
} maybe useful |
Mid-September 2020FWIW 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. |
In my case, I am developing an ASP.NET MVC Core (2.1) with a Microsoft npm module Unfortunately, the Downgrading to webpack 4.x resolves the issue. |
Let's close, should be fixed, if somebody faced with this issue again, feel free to open the new issue, in most cases this error, means you have invalid |
Just to keep things together I think #2164 (comment) might be related |
@alexander-akait doesn't webpack-dev-server automatically choose the port if you don't provide one and the default is already used? To have a configuration that is the most flexible, following webpack's behavior, is it possible to set the correct |
Reproducible test repos:
Shortly: publichPath in webpack-dev-server doesn't override publisPath in webpack
Need search way how better handle publicPath
#1591 (comment)
#1591 (comment)
Code
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.
The text was updated successfully, but these errors were encountered: