Skip to content

Replace vite-node with Vite's built-in Module Runner #1210

Description

@stipsan

vite-node has "finished its mission" — its readme recommends Vite's built-in Module Runner for new projects, and Vitest already migrated off it (https://npmx.dev/package/vite-node).

We use it only in packages/@sanity/cli-core/src/loaders/studio/studioWorkerLoader.worker.ts (ViteNodeServer, ViteNodeRunner, vite-node/source-map) and declare it in packages/@sanity/cli-core/package.json.

Goal: migrate the studio worker loader to Vite's Module Runner (vite/module-runner + createServerModuleRunner), then drop the vite-node dependency.

Port over the worker's custom behavior: the fetchModule/resolveId overrides for https:// imports, sourcemap support (installSourcemapsSupport), and the executeId('/@vite/env') step.

Follow-up from #1150.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions