Skip to content

Disabling WebSocket and HMR #18489

@gderiyenko

Description

@gderiyenko

Description

Some users are actively seeking ways to disable HMR (#13994).

With HML enabled, and reactive components are partially rendered, it is unpredictable #18217 when page reload happens.
From my personal experience, the page reloads multiple times, even during simple navigation within the project.

Suggested solution

Please provide an option for users to disable WebSocket and HMR.

    server: {
        socket: false,
        hmr: false,
    },

A single page reload after updating code in the editor is sufficient and might be optimal solution.
Fortunately, Vite is capable of updating CSS and JS files even without WebSocket enabled.

Alternative

Screenshot 2024-10-28 at 05 35 52

Additional context

Normally I do not change the library's code. However, this changes made my developing experience much more predictable and less annoying with unexpected reloads.

function setupWebSocket(protocol, hostAndPath, onCloseWithoutOpen) {
  if (!socketEnabled) return;

Thanks.

Validations

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions