Skip to content
Discussion options

You must be logged in to vote

After removing ws, vite hmr can work...

Perhaps this can be used as an answer, although the browser print some WS connection error log, at least it can be used for normal development work.

import { Elysia } from 'elysia'

export const frontendPlugin = new Elysia()
  .all('/*', async ({ request }) => {
    const url = new URL(request.url)
    const target = `http://localhost:5173${url.pathname}${url.search}`
  
    const headers = new Headers(request.headers)
    headers.set('host', 'localhost:5173')
    headers.delete('origin')
    headers.delete('connection')
  
    return await fetch(target, {
      method: request.method,
      headers,
      body: request.body,
      redirect: 'manual',…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@seepine
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by seepine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants