Skip to content

Commit

Permalink
fix: create a new runtime instead of caching one
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Jun 2, 2024
1 parent fec9128 commit 3ed37db
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@

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

import { makeAttributes, uniqBy } from './utils.js'
import type { AdonisViteElement, SetAttributes, ViteOptions } from './types.js'
Expand Down Expand Up @@ -346,11 +351,12 @@ export class Vite {
}

/**
* Get the Vite runtime instance
* Will not be available when running in production
* Create a runtime instance
* Will not be available when running in production since
* it needs the Vite Dev server
*/
getRuntime() {
return this.#runtime
createRuntime(options: MainThreadRuntimeOptions = {}) {
return createViteRuntime(this.#devServer!, options)
}

/**
Expand Down

0 comments on commit 3ed37db

Please sign in to comment.