-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
test(remix-dev/vite): test custom server.hmr.server
vite config
#8095
Closed
hi-ogawa
wants to merge
7
commits into
remix-run:dev
from
hi-ogawa:fix-vite-child-vite-server-double-handleUpgrade-custom-server
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
68a6495
fix(remix-dev/vite): fix websocket double `handleUpgrade` error with …
hi-ogawa 2f8c248
chore: minor cleanup
hi-ogawa a8f6cb0
Merge branch 'dev' into fix-vite-child-vite-server-double-handleUpgra…
hi-ogawa 27e1666
test: test custom `hmr.server` config
hi-ogawa f5ad741
chore: lint
hi-ogawa ae0ebf6
chore: changeset
hi-ogawa 1ac18c4
Merge branch 'dev' into fix-vite-child-vite-server-double-handleUpgra…
hi-ogawa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@remix-run/dev": patch | ||
--- | ||
|
||
Fix websocket error when using custom vite hmr server config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced
unstable_createViteServer
with direct use ofvite.createServer
since currentlyunstable_createViteServer
doesn't support passing vite config.It might make sense to tweak the API of
unstable_createViteServer
(or remove it entirely in favor of direct vite call?). Please let me know if anyone has opinion on this.Also, FYI, using
server.hmr.server
option is one of recommended setups from https://github.com/sapphi-red/vite-setup-catalogue/blob/48cde75352005aa1c1780f5eccf022db5619e285/examples/middleware-mode/server.js (explained further in sapphi-red/vite-setup-catalogue#16 and also this repo is linked from vite's documentation https://vitejs.dev/config/server-options.html#server-hmr)I just noticed there is now
basicTemplate
which includes custom server setup.Maybe updating
server.mjs
there or having a dedicated test case for this custom server scenario might make more sense.Please let me know if there is a preferred way to test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that direct use of
vite.createServer
is better, because if you have a need to create vite server it's because you need to customize something.But if you want to have
unstable_createViteServer
, at least allow to pass config modifications. Current implementation is not doing something special (only settingmiddlewareMode
) so it's not necessary.