Skip to content

fix(mergeConfig): don't recreate server.hmr.server instance - #17763

Merged
patak-cat merged 1 commit into
vitejs:mainfrom
Vija02:main
Jul 30, 2024
Merged

fix(mergeConfig): don't recreate server.hmr.server instance#17763
patak-cat merged 1 commit into
vitejs:mainfrom
Vija02:main

Conversation

@Vija02

@Vija02 Vija02 commented Jul 25, 2024

Copy link
Copy Markdown
Contributor

Description

Currently, the mergeConfig function recursively goes through objects and overrides them. This works for the most part, except for the server.hmr.server property which is a Server class/object.

The problem is that the mergeConfig function treats it like a normal JS object and effectively clones it. This turns it into a standard object which doesn't work. And it also breaks reference to the object.

We either need to modify the isObject function to check for classes, or for now, I've added an if statement to handle the special case, following the other precedence.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@bluwy bluwy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think it's fine to keep it simple and handle this specific case for now. We can revisit checking classes next time.

@patak-cat
patak-cat merged commit 5c55b29 into vitejs:main Jul 30, 2024
@patak-cat patak-cat added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants