Skip to content

Commit

Permalink
feat: allow options to be passed to createDevServer
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Jun 2, 2024
1 parent bce1201 commit 6c6080c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import { readFileSync } from 'node:fs'
import type { ViteRuntime } from 'vite/runtime'
import type { MainThreadRuntimeOptions, Manifest, ViteDevServer } from 'vite'
import type { InlineConfig, MainThreadRuntimeOptions, Manifest, ViteDevServer } from 'vite'

import { makeAttributes, uniqBy } from './utils.js'
import type { AdonisViteElement, SetAttributes, ViteOptions } from './types.js'
Expand Down Expand Up @@ -318,12 +318,13 @@ export class Vite {
* We lazy load the APIs to avoid loading it in production
* since we don't need it
*/
async createDevServer() {
async createDevServer(options?: InlineConfig) {
const { createServer } = await import('vite')

this.#devServer = await createServer({
server: { middlewareMode: true, hmr: { port: 3001 } },
appType: 'custom',
...options,
})
}

Expand Down

0 comments on commit 6c6080c

Please sign in to comment.