Skip to content

Commit

Permalink
fix(module-runner): make evaluator optional (#18672)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Nov 19, 2024
1 parent 5ec9eed commit fd1283f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/vite/src/module-runner/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
import { hmrLogger, silentConsole } from './hmrLogger'
import { createHMRHandler } from './hmrHandler'
import { enableSourceMapSupport } from './sourcemap/index'
import { ESModulesEvaluator } from './esmEvaluator'

interface ModuleRunnerDebugger {
(formatter: unknown, ...args: unknown[]): void
Expand Down Expand Up @@ -61,7 +62,7 @@ export class ModuleRunner {

constructor(
public options: ModuleRunnerOptions,
public evaluator: ModuleEvaluator,
public evaluator: ModuleEvaluator = new ESModulesEvaluator(),
private debug?: ModuleRunnerDebugger,
) {
const root = this.options.root
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/node/ssr/runtime/serverModuleRunner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync, readFileSync } from 'node:fs'
import { ESModulesEvaluator, ModuleRunner } from 'vite/module-runner'
import { ModuleRunner } from 'vite/module-runner'
import type {
ModuleEvaluator,
ModuleRunnerHmr,
Expand Down Expand Up @@ -133,6 +133,6 @@ export function createServerModuleRunner(
hmr,
sourcemapInterceptor: resolveSourceMapOptions(options),
},
options.evaluator || new ESModulesEvaluator(),
options.evaluator,
)
}

0 comments on commit fd1283f

Please sign in to comment.