Skip to content

Vite 8 deprecation: plugin sets server.hmr.{host,protocol,clientPort,path} — should use server.ws.* #292

Description

@cofin

Summary

On Vite 8, litestar-vite-plugin emits this deprecation warning during build / dev start:

`server.hmr.protocol/host/port/path/clientPort/timeout/server` is deprecated. Use `server.ws.*` instead.
Note that this option may be set by a plugin.

It fires even when the project's vite.config does not set server.hmr at all — the plugin injects it.

Environment

  • litestar-vite-plugin 0.24.1
  • vite 8.1.0

Source

The plugin injects the deprecated HMR network sub-options under server.hmr in dist/js/index.js:

  • the config hook sets server.hmr = { path: "vite-hmr", clientPort?, ... } (~L145–149)
  • later hmr: { host } / hmr: { host: resolvedHost } (~L847, ~L880)

In Vite 8 the HMR network options (host, protocol, port, path, clientPort, timeout) moved from server.hmr.* to server.ws.*. server.hmr should now carry only non-network toggles (e.g. overlay, or false to disable).

Suggested fix

Emit the network options under server.ws.* instead of server.hmr.*, keeping server.hmr only for the enable/disable toggle. May need to gate on Vite major version for back-compat with Vite 5–7.

Repro

Any litestar-vite project on Vite 8 → vite build (or dev server start) prints the warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions