Skip to content

Improve experience of switching branches with running dev server #20157

@jimmycallin

Description

@jimmycallin

Description

I understand this might be considered out of scope for vite, but something I frequently experience is the vite dev server crashing when switching branches, mainly due to package version dependency mismatches, causing vite to try to hot reload and (understandably) gets confused by missing packages.

To mitigate this, I quit the vite dev server, run yarn, and then restart the dev server.

Suggested solution

I'm not sure if there is a viable solution for this. If there was a way to avoid having to restart the vite dev server, perhaps by checking for changes in node_modules or lock files and somehow recognizing that package installers have finished installing the new state, I think it would provide a superior experience. Then users can, if they want, set up automatic installation on branch switching using e.g. husky, and have a seamless branch switching experience even with dependency version mismatches.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions