Skip to content

Vite 8 needs longer timeout waiting on dev server #616

Description

@jrochkind

Since upgrading vite, I was having trouble getting the vite dev server to be recognized by running rails dev server.

Claude suggested it was because recent vite dev server could take longer to start due to more checks at startup, and suggested a fix by increasing devServerConnectTimeout from the generated 0.01 to 0.5.

This indeed worked. In config/vite.json:

"development": {
#...
"devServerConnectTimeout": 0.5
}

Should vite_ruby default be increased to accomodate slower vite dev server startup in recent versions?

"devServerConnectTimeout": 0.01,

Or another change such that there's only a longer timeout in first request or something like that? Or vite rails server side being willing to re-check for vite dev server, instead of permanently caching the "not available" value? It does look like once vite dev server times out once, it won't be used by vite rails again (until process restart).

Not totally sure the optimal solution or if I understand what is going on, but I know vite dev server was mostly not working for me and this change did fix it.

This is a potential frustrating gotcha waiting for someone new getting started with vite ruby, doesn't want to begin with a confusing debugging situation or not even realizing they are getting degraded functionality and performace because dev server isn't being used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions