Closed zwarag closed 3 weeks ago
Sorry, I can't say there is a problem without reproduciable example and we always sent Content-Length
header in such case - https://github.com/webpack/webpack-dev-middleware/blob/v7.2.1/src/middleware.js#L695 (based on your stacktrace), so I think the problem in another place and maybe not related to weback-dev-middleware
Anyway if you can create a reproducible repo I will investigate
Hello, I am having the same issue in a React project, changing the version of webpack-dev-middleware
from 7.3.0 to 7.2.1 in the lockfile "solves" the problem.
I also noticed that while it happens when NODE_ENV="production"
it does not happen if NODE_ENV="development"
in my case.
The devServer
block in webpack.config.js
:
devServer: {
open: true,
allowedHosts: 'all',
hot: true,
compress: false,
static: {
directory: path.join(__dirname, 'src'),
},
devMiddleware: {
stats: 'minimal',
},
client: {
overlay: {
errors: true,
warnings: false,
},
},
historyApiFallback: {
rewrites: [{
from: /^\/.*$/,
to: '/',
}],
},
}
There are no problems with devServer
, looks like something sent content early than we, without context it is hard to say who...
/cc @alan-agius4 Maybe I can help with debug?
@alexander-akait, without a reproduction of the issue, it's difficult to understand what's going on. Unless a reproduction is provided, I’d say this is not actionable.
I was running into this problem with start-server-and-test. I found this note in the README about webpack-dev-server
not handling HEAD requests: https://github.com/bahmutov/start-server-and-test/blob/8ebb70b7b2be40b4b1b2f08d0b9c3ef51dfaca10/README.md#note-for-webpack-dev-server-users
Changing to GET requests per the note worked for me. I'm not sure why HEAD requests worked for me before (?) but it only became an issue when I was updating dependencies and webpack-dev-middleware
was indirectly bumped from 7.2.1 to 7.3.1.
That's weird, because we are doing it https://github.com/webpack/webpack-dev-middleware/blob/master/src/middleware.js#L800, can you debug it locally and provide more infromation?
I have a minimal repro of the issue here: https://github.com/shanedg/webpack-dev-middleware-1920
I will look soon, thank you
Found a problem, fix will soon
Thank you @alexander-akait
Hello webpack Team. I believe there is a regression between 7.2.1 and 7.3.0.
Bug report
In our angular project we use webpack builder. This has a dependency to webpack-dev-middleware. When setting up a project that uses 7.3.0, an error is thrown as seen below.
NOTE: The setup is just a default setup, but we still use webpack instead of esbuild.
Actual Behavior
An error is thrown after starting the project. The interesting thing is that our projects do not have SSR enabled in any way. So what webpack does is to just behave as a file server.
There seems to be other users affected by this: https://stackoverflow.com/questions/78777506/angular-18-post-request-node-http-outgoing659-throw-new-err-http-headers-sen
Expected Behavior
No regression, 7.3.0 should work like 7.2.1.
How Do We Reproduce?
I'm sorry, I'm not able to provide an minimal reproducable example.
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationwebpack info:
Error: