Skip to content

refactor(dev/vite): use @mjackson/node-fetch-server #13927

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

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

MichaelDeBoey
Copy link
Member

@MichaelDeBoey MichaelDeBoey commented Jul 3, 2025

@acusti mentioned in #12774 (comment) that @mjackson/node-fetch-server could be used as a drop-in replacement for the current node-adapter.ts file

This started my journey and I came to the following history of the file:

  1. @pcattori started it all in Cloudflare support for Vite remix#8531
  2. @hi-ogawa added support for a custom basename
    Since this is not really supported by @mjackson/node-fetch-server, I kept the small wrapper.
    @mjackson if a custom basename would be supported in the lib, then I probably looked over it, so please point me towards the correct docs
    If it's not (yet) available in the lib and you would like to somehow support it, I'm happy to help out with a PR
  3. @brophdawg11's 3285264 (original PR Proxy request.signal through in vite dev remix#9976) is already implemented in https://github.com/mjackson/remix-the-web/blob/4f69c6cdfd71d8c5376269e778f2e3a1611924fa/packages/node-fetch-server/src/lib/request-listener.ts#L132-L134
  4. However, @brophdawg11's d386c0d (original PR Fix adapter logic for aborting requests remix#10046) isn't implemented (yet).
    @mjackson I created fix(node-fetch-server): fix logic for aborting requests mjackson/remix-the-web#74 to do the same in @mjackson/node-fetch-server
  5. @timdorr's fix(dev/vite): Strip HTTP/2 pseudo headers from dev server requests  #12830 seems to be already implemented by skipping all headers that start with : in createHeaders
    https://github.com/mjackson/remix-the-web/blob/4f69c6cdfd71d8c5376269e778f2e3a1611924fa/packages/node-fetch-server/src/lib/request-listener.ts#L180
  6. @jacob-briscoe's fix(dev): conditionally set status message for HTTP/2 compatibility #13460 doesn't seem to be implemented in sendResponse (yet).
    @mjackson if it would be supported in the lib, then I probably looked over it, so please point me towards the correct docs
    If it's not (yet) available in the lib and you would like to somehow support it, I'm happy to help out with a PR
  7. @TrySound's fix(dev/vite): properly handle https protocol in dev mode #13746 (resubmission of fix(dev): detect https protocol remix#10199) is already handled in createRequest
    https://github.com/mjackson/remix-the-web/blob/4f69c6cdfd71d8c5376269e778f2e3a1611924fa/packages/node-fetch-server/src/lib/request-listener.ts#L139-L140
    @mjackson I just created refactor(node-fetch-server): add type-safety to socket check in createRequest mjackson/remix-the-web#75 to make it a bit more type-safe

So it seems like once mjackson/remix-the-web#74 is merged (and released) and 2️⃣ & 6️⃣ have more clarity, we can indeed just replace the current node-adapter.ts file with @mjackson/node-fetch-server.

Added benefit here is that we don't need to rely on set-cookie-parser anymore and we now rely on a lib that's going to be part of Remix v3 anyways


I'm sure people from the wider @e18e ecosystem cleanup (like @43081j & @outslept) will be very happy to see these kind of changes as well

Copy link

changeset-bot bot commented Jul 3, 2025

⚠️ No Changeset found

Latest commit: 232d15d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@MichaelDeBoey MichaelDeBoey force-pushed the use-mjackson__node-fetch-server branch from 45d0716 to 232d15d Compare July 3, 2025 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant