vite-plugins icon indicating copy to clipboard operation
vite-plugins copied to clipboard

[@hono/vite-dev-server] Allow setting port for dev server

Open gkiely opened this issue 2 years ago • 1 comments

It is useful to be able to to set the server port to a different port to the vite server. Currently passing port to the cf object doesn't work.

gkiely avatar Nov 06 '23 03:11 gkiely

The workaround is to use a separate vite server config file and use concurrently to run 2 vite processes, but it would be nice if this was not needed.

concurrently -r -g 'vite --config vite.server.config.ts' 'vite'
// Client config
import { defineConfig } from 'vite';
export default defineConfig({
  // ...
});

// Server config
import devServer from '@hono/vite-dev-server';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [
    devServer({
      entry: 'server/server.ts',
    }),
  ],
  server: {
    port: 8080,
  },
});

gkiely avatar Nov 06 '23 04:11 gkiely