rspack
rspack copied to clipboard
fix(dev-middleware): compatibility with native node handler
Summary
Currently there are two issues I'm facing with dev-middleware:
- it uses
express-only handlers likereq.pathandres.send() - it does not respect a public path (I may be misunderstanding how this is meant to be used though - should this only be registered to handle paths beginning with the publicPath?
This PR uses node-compatible methods (req.url and res.end()) which will also work in express, expanding the compatibility of this library. It also normalises any URLs beginning with publicPath so they can be handled in this middleware.
(I am happy to remove the change to publicPath handling if this is intended.)
Related issue (if exists)
Types of changes
- [ ] Docs change / Dependency upgrade
- [x] Bug fix
- [ ] New feature / Improvement
- [ ] Refactoring
- [ ] Breaking change
Checklist
- [x] I have added changeset via
pnpm run changeset. - [ ] I have added tests to cover my changes.
🦋 Changeset detected
Latest commit: 9366be785bb3fe4570e2abe702f348236ad0c129
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 16 packages
| Name | Type |
|---|---|
| @rspack/dev-middleware | Patch |
| @rspack/dev-server | Patch |
| @rspack/cli | Patch |
| benchmarkcase-rspack-react-refresh | Patch |
| @rspack/postcss-loader | Patch |
| @rspack/dev-client | Patch |
| @rspack/plugin-html | Patch |
| @rspack/plugin-minify | Patch |
| @rspack/plugin-node-polyfill | Patch |
| @rspack/core | Patch |
| @rspack/binding-darwin-arm64 | Patch |
| @rspack/binding-darwin-x64 | Patch |
| @rspack/binding-linux-x64-gnu | Patch |
| @rspack/binding-win32-x64-msvc | Patch |
| @rspack/binding | Patch |
| @rspack/fs | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR