Open History to see the last commit
1import { VIRTUAL_MODULES } from '@tanstack/start-server-core/virtual-modules'
2import { generateSerializationAdaptersModule } from '../serialization-adapters-module'
3import { generateServerFnResolverModule } from '../start-compiler/server-fn-resolver-module'
4import { buildStartManifest } from '../start-manifest-plugin/manifestBuilder'
5import { escapeRegExp } from '../utils'
6import { RSBUILD_ENVIRONMENT_NAMES } from './planning'
7import type {
8 RsbuildPluginAPI,
9 rspack as rspackNamespaceType,
10} from '@rsbuild/core'
11import type {
12 GetConfigFn,
13 NormalizedClientBuild,
14 SerializationAdapterConfig,
15} from '../types'
16import type { InlineCssOptions } from '../start-manifest-plugin/manifestBuilder'
17import type { ServerFn } from '../start-compiler/types'
18import type { ScriptFormat } from '@tanstack/router-core'
19β
20type RspackNamespace = typeof rspackNamespaceType
21type RspackVirtualModulesPlugin = InstanceType<
22 RspackNamespace['experiments']['VirtualModulesPlugin']
23>
24β
25// Virtual module IDs for RSC (must match what react-start-rsc imports)
26const RSC_RUNTIME_VIRTUAL_ID = 'virtual:tanstack-rsc-runtime'
27const RSC_HMR_VIRTUAL_ID = 'virtual:tanstack-rsc-hmr'
28const RSC_BROWSER_DECODE_VIRTUAL_ID = 'virtual:tanstack-rsc-browser-decode'
29const RSC_SSR_DECODE_VIRTUAL_ID = 'virtual:tanstack-rsc-ssr-decode'
30export const START_MANIFEST_PLACEHOLDER = '__TSS_START_MANIFEST_PLACEHOLDER__'
31const DEV_START_MANIFEST_GLOBAL = '__TSS_DEV_START_MANIFEST__'
32/**
33 * VirtualModulesPlugin resolves module paths relative to compiler.context.
34 * Prefix them under the app root so they are unique and watcher-friendly.
35 */
36function virtualPath(root: string, moduleId: string): string {
37 // VirtualModulesPlugin resolves paths relative to compiler.context (root).
38 // Use a recognizable prefix to avoid collisions with real files.
39 const sanitized = moduleId.replace(/[:#]/g, '_')
40 return `${root}/node_modules/.virtual/${sanitized}.js`
41}
42β
43export interface VirtualModuleState {
44 /** Call to update manifest content after client build completes */
45 updateManifest: (clientBuild: NormalizedClientBuild) => void
46 /** Call to update server fn resolver content after compilation discovers fns */
47 updateServerFnResolver: () => void
48 /** Try to write explicit resolver content now; queues if env not ready */
49 tryUpdateServerFnResolver: (content: string) => void
50 /** Get the virtual path for a given module ID */
51 getVirtualPath: (moduleId: string) => string
52 /** Generate resolver module content from current serverFnsById state.
53 * When forProvider=true, generates without isClientReferenced checks (RSC layer). */
54 generateCurrentResolverContent: (forProvider?: boolean) => string
55 /** The absolute virtual path of the server fn resolver module */
56 serverFnResolverPath: string
57 /** The absolute virtual path of the manifest module */
58 manifestPath: string
59 /** Generate manifest module content from a given client build */
60 generateManifestContent: (clientBuild: NormalizedClientBuild) => string
61 /** Generate the serialized manifest value literal for asset patching */
62 generateManifestValueLiteral: (clientBuild: NormalizedClientBuild) => string
63 /** VirtualModulesPlugin instances keyed by environment name */
64 vmPlugins: Record<string, RspackVirtualModulesPlugin>
65}
66β
67// ---------------------------------------------------------------------------
68// Manifest module codegen
69// ---------------------------------------------------------------------------
70β
71function getScriptFormatProperty(scriptFormat: ScriptFormat): string {
72 return scriptFormat === 'iife' ? ` scriptFormat: 'iife',\n` : ''
73}
74β
75function getEntryScriptAttrs(
76 entryUrl: string,
77 scriptFormat: ScriptFormat,
78): string {
79 return scriptFormat === 'module'
80 ? `{ type: 'module', async: true, src: '${entryUrl}' }`
81 : `{ async: true, src: '${entryUrl}' }`
82}
83β
84function generateManifestModuleDev(
85 devClientEntryUrl: string,
86 scriptFormat: ScriptFormat,
87): string {
88 const scriptFormatProperty = getScriptFormatProperty(scriptFormat)
89 return `const fallbackManifest = {
90${scriptFormatProperty} routes: {
91 __root__: {
92 preloads: ['${devClientEntryUrl}'],
93 scripts: [{ attrs: ${getEntryScriptAttrs(devClientEntryUrl, scriptFormat)} }],
94 },
95 },
96}
97export const tsrStartManifest = () => globalThis[${JSON.stringify(DEV_START_MANIFEST_GLOBAL)}] ?? fallbackManifest`
98}
99β
100function buildStartManifestData(
101 clientBuild: NormalizedClientBuild,
102 publicBase: string,
103 inlineCss: InlineCssOptions,
104 scriptFormat: ScriptFormat,
105) {
106 const routeTreeRoutes = globalThis.TSS_ROUTES_MANIFEST
107 return buildStartManifest({
108 clientBuild,
109 routeTreeRoutes,
110 basePath: publicBase,
111 inlineCss,
112 scriptFormat,
113 })
114}
115β
116function serializeStartManifestData(
117 clientBuild: NormalizedClientBuild,
118 publicBase: string,
119 inlineCss: InlineCssOptions,
120 scriptFormat: ScriptFormat,
121): string {
122 return JSON.stringify(
123 buildStartManifestData(clientBuild, publicBase, inlineCss, scriptFormat),
124 )
125}
126β
127function generateManifestModuleBuild(
128 clientBuild: NormalizedClientBuild | undefined,
129 publicBase: string,
130 _devClientEntryUrl: string,
131 inlineCss: InlineCssOptions,
132 scriptFormat: ScriptFormat,
133): string {
134 if (!clientBuild) {
135 return `const tsrStartManifestData = ${JSON.stringify(START_MANIFEST_PLACEHOLDER)}
136export const tsrStartManifest = () => tsrStartManifestData`
137 }
138β
139 return `export const tsrStartManifest = () => (${serializeStartManifestData(clientBuild, publicBase, inlineCss, scriptFormat)})`
140}
141β
142/**
143 * Generate virtual:tanstack-rsc-runtime content.
144 * In the RSC layer this re-exports from react-server-dom-rspack/server.
145 * In other layers it provides stubs that throw.
146 */
147function generateRscRuntimeModule(isRscLayer: boolean): string {
148 if (isRscLayer) {
149 // Re-export the RSC runtime functions from react-server-dom-rspack/server.
150 // NOTE: `createFromReadableStream` is a CLIENT-side API β it's NOT exported
151 // by react-server-dom-rspack/server. The RSC layer never needs it (RSC
152 // renders TO streams, doesn't decode FROM them). We provide a stub that
153 // throws so the export surface stays consistent across bundlers.
154 return `export { renderToReadableStream, createTemporaryReferenceSet, decodeReply, decodeAction, decodeFormState } from 'react-server-dom-rspack/server'
155export function createFromReadableStream() { throw new Error('createFromReadableStream is not available in RSC environment (use SSR or browser decode instead)'); }
156// loadServerAction is provided by the RSC entry, not react-server-dom-rspack
157import { getServerFnById } from '#tanstack-start-server-fn-resolver'
158export const loadServerAction = async (id) => getServerFnById(id, { origin: 'server' })`
159 }
160β
161 // In other layers, provide stubs that throw
162 return `
163export function renderToReadableStream() { throw new Error('renderToReadableStream can only be used in RSC environment'); }
164export function createFromReadableStream() { throw new Error('createFromReadableStream can only be used in RSC environment'); }
165export function createTemporaryReferenceSet() { throw new Error('createTemporaryReferenceSet can only be used in RSC environment'); }
166export function decodeReply() { throw new Error('decodeReply can only be used in RSC environment'); }
167export function loadServerAction() { throw new Error('loadServerAction can only be used in RSC environment'); }
168export function decodeAction() { throw new Error('decodeAction can only be used in RSC environment'); }
169export function decodeFormState() { throw new Error('decodeFormState can only be used in RSC environment'); }
170`
171}
172β
173/**
174 * Generate virtual:tanstack-rsc-hmr content.
175 * In the client env during dev, listens for rsc:update WebSocket events
176 * and invalidates the router. In all other contexts, exports nothing.
177 */
178function generateRscHmrModule(isClientEnv: boolean, isDev: boolean): string {
179 if (!isClientEnv || !isDev) {
180 return 'export function setupRscHmr() {}'
181 }
182β
183 // Rsbuild dev server delivers custom WebSocket events through
184 // import.meta.webpackHot.on(event, cb). The server-side
185 // sockWrite('custom', { event: 'rsc:update' }) maps directly to that.
186 return `
187// RSC HMR listener for rsbuild dev server
188// Listens for 'rsc:update' custom events sent via sockWrite
189export function setupRscHmr() {
190 let __invalidateQueued = false
191β
192 function __queueInvalidate() {
193 if (__invalidateQueued) return
194 __invalidateQueued = true
195 queueMicrotask(async () => {
196 __invalidateQueued = false
197 try {
198 const router = window.__TSR_ROUTER__
199 if (!router) {
200 console.warn('[rsc:hmr] No router found on window.__TSR_ROUTER__')
201 return
202 }
203 await router.invalidate()
204 } catch (e) {
205 console.warn('[rsc:hmr] Failed to invalidate router:', e)
206 }
207 })
208 }
209β
210 if (import.meta.webpackHot) {
211 import.meta.webpackHot.on('rsc:update', () => {
212 __queueInvalidate()
213 })
214 }
215}
216`
217}
218β
219// ---------------------------------------------------------------------------
220// Main registration
221// ---------------------------------------------------------------------------
222β
223export interface RegisterVirtualModulesOptions {
224 root: string
225 getConfig: GetConfigFn
226 serverFnsById: Record<string, ServerFn>
227 providerEnvName: string
228 ssrIsProvider: boolean
229 serializationAdapters: Array<SerializationAdapterConfig> | undefined
230 /**
231 * Get the URL at which the rsbuild dev server serves the client entry JS.
232 * Called lazily inside modifyRspackConfig when getConfig() is available.
233 * Example return: '/assets/js/index.js'
234 */
235 getDevClientEntryUrl: (publicBase: string) => string
236 /** Whether RSC virtual modules should be registered. */
237 rscEnabled?: boolean | undefined
238 scriptFormat: ScriptFormat
239}
240β
241/**
242 * Registers virtual modules for the rsbuild adapter using VirtualModulesPlugin.
243 *
244 * Creates one VirtualModulesPlugin per environment and registers them via
245 * `modifyBundlerChain`. Provides update functions to refresh content dynamically.
246 */
247export function registerVirtualModules(
248 api: RsbuildPluginAPI,
249 opts: RegisterVirtualModulesOptions,
250): VirtualModuleState {
251 const isDev = api.context.action === 'dev'
252 const root = opts.root
253β
254 // Virtual module paths keyed by module ID
255 const paths = {
256 manifest: virtualPath(root, VIRTUAL_MODULES.startManifest),
257 serverFnResolver: virtualPath(root, VIRTUAL_MODULES.serverFnResolver),
258 pluginAdapters: virtualPath(root, VIRTUAL_MODULES.pluginAdapters),
259 }
260β
261 // RSC virtual module paths (only defined when RSC is enabled)
262 const rscPaths = opts.rscEnabled
263 ? {
264 rscRuntime: virtualPath(root, RSC_RUNTIME_VIRTUAL_ID),
265 rscHmr: virtualPath(root, RSC_HMR_VIRTUAL_ID),
266 rscBrowserDecode: virtualPath(root, RSC_BROWSER_DECODE_VIRTUAL_ID),
267 rscSsrDecode: virtualPath(root, RSC_SSR_DECODE_VIRTUAL_ID),
268 }
269 : null
270β
271 // Track VirtualModulesPlugin instances per environment for dynamic updates
272 const vmPlugins: Record<string, RspackVirtualModulesPlugin> = {}
273 const readyVmPlugins: Record<string, boolean> = {}
274 const pendingWrites = new Map<string, Map<string, string>>()
275β
276 let clientBuild: NormalizedClientBuild | undefined
277 const lastResolverContentByEnvironment: Record<string, string | undefined> =
278 {}
279 const hasSeparateProviderEnvironment =
280 !opts.rscEnabled &&
281 opts.providerEnvName !== RSBUILD_ENVIRONMENT_NAMES.server
282 const hasSerializationAdapters = Boolean(opts.serializationAdapters?.length)
283β
284 function isProviderEnvironment(environmentName: string): boolean {
285 return environmentName === opts.providerEnvName
286 }
287β
288 function needsServerFnResolver(environmentName: string): boolean {
289 return (
290 environmentName === RSBUILD_ENVIRONMENT_NAMES.server ||
291 (hasSeparateProviderEnvironment && isProviderEnvironment(environmentName))
292 )
293 }
294β
295 function generateResolverContent(environmentName: string): string {
296 return generateServerFnResolverModule({
297 serverFnsById: opts.serverFnsById,
298 includeClientReferencedCheck: !isProviderEnvironment(environmentName),
299 useStaticImports: Boolean(opts.rscEnabled && isDev),
300 memoizeModules: !isDev,
301 })
302 }
303β
304 function writeResolverContent(environmentName: string, content: string) {
305 if (
306 !isDev ||
307 content !== lastResolverContentByEnvironment[environmentName]
308 ) {
309 lastResolverContentByEnvironment[environmentName] = content
310 tryWriteModule(environmentName, paths.serverFnResolver, content)
311 }
312 }
313β
314 function queuePendingWrite(
315 environmentName: string,
316 filePath: string,
317 content: string,
318 ) {
319 let writes = pendingWrites.get(environmentName)
320 if (!writes) {
321 writes = new Map()
322 pendingWrites.set(environmentName, writes)
323 }
324 writes.set(filePath, content)
325 }
326β
327 function tryWriteModule(
328 environmentName: string,
329 filePath: string,
330 content: string,
331 ) {
332 const vmPlugin = vmPlugins[environmentName]
333 if (!vmPlugin || !readyVmPlugins[environmentName]) {
334 queuePendingWrite(environmentName, filePath, content)
335 return false
336 }
337β
338 vmPlugin.writeModule(filePath, content)
339 return true
340 }
341β
342 function flushPendingWrites(environmentName: string) {
343 if (!readyVmPlugins[environmentName]) {
344 return
345 }
346β
347 const writes = pendingWrites.get(environmentName)
348 if (!writes?.size) {
349 return
350 }
351β
352 for (const [filePath, content] of writes) {
353 if (!tryWriteModule(environmentName, filePath, content)) {
354 return
355 }
356 writes.delete(filePath)
357 }
358β
359 if (writes.size === 0) {
360 pendingWrites.delete(environmentName)
361 }
362 }
363β
364 // NOTE: getConfig() is deferred β it must NOT be called until modifyRsbuildConfig
365 // has resolved (which sets resolvedStartConfig.root). All access to resolvedStartConfig
366 // happens inside modifyRspackConfig (which runs after modifyRsbuildConfig) or
367 // inside update callbacks (which run even later during/after compilation).
368β
369 // Generate initial content for each virtual module per environment
370 function getInitialContent(environmentName: string): Record<string, string> {
371 // Safe to call getConfig() here β this runs inside modifyRspackConfig
372 const { resolvedStartConfig, startConfig } = opts.getConfig()
373 const isServerEnv = environmentName === RSBUILD_ENVIRONMENT_NAMES.server
374 const isClientEnv = environmentName === RSBUILD_ENVIRONMENT_NAMES.client
375 const content: Record<string, string> = {}
376β
377 // Manifest β only meaningful for server env
378 if (isServerEnv) {
379 const devClientEntryUrl = opts.getDevClientEntryUrl(
380 resolvedStartConfig.basePaths.publicBase,
381 )
382 content[paths.manifest] = isDev
383 ? generateManifestModuleDev(devClientEntryUrl, opts.scriptFormat)
384 : generateManifestModuleBuild(
385 clientBuild,
386 resolvedStartConfig.basePaths.publicBase,
387 devClientEntryUrl,
388 startConfig.server.build.inlineCss,
389 opts.scriptFormat,
390 )
391 } else {
392 content[paths.manifest] = 'export default {}'
393 }
394β
395 // Server fn resolver β SSR and provider environments
396 if (needsServerFnResolver(environmentName)) {
397 content[paths.serverFnResolver] = generateResolverContent(environmentName)
398 } else {
399 // Client doesn't need the resolver but needs a valid module
400 content[paths.serverFnResolver] = 'export {}'
401 }
402β
403 if (hasSerializationAdapters) {
404 // Plugin adapters β both environments get environment-specific content
405 content[paths.pluginAdapters] = generateSerializationAdaptersModule({
406 adapters: opts.serializationAdapters,
407 runtime:
408 environmentName === RSBUILD_ENVIRONMENT_NAMES.client
409 ? 'client'
410 : 'server',
411 })
412 }
413β
414 // --- RSC virtual modules ---
415 if (rscPaths) {
416 // virtual:tanstack-rsc-runtime
417 // In the server env, this provides the RSC runtime for the RSC layer.
418 // The virtual module content is the same regardless of layer since
419 // rspack layers handle module isolation. The RSC entry imports this
420 // and the react-server condition on the RSC layer resolves
421 // react-server-dom-rspack/server correctly.
422 if (isServerEnv) {
423 // Server env gets the real RSC runtime (used by RSC layer)
424 content[rscPaths.rscRuntime] = generateRscRuntimeModule(true)
425 } else {
426 // Client env gets stubs
427 content[rscPaths.rscRuntime] = generateRscRuntimeModule(false)
428 }
429β
430 // virtual:tanstack-rsc-hmr
431 content[rscPaths.rscHmr] = generateRscHmrModule(isClientEnv, isDev)
432 content[rscPaths.rscBrowserDecode] = isClientEnv
433 ? `export * from '@tanstack/react-start/rsbuild/browser-decode'`
434 : `export function createFromReadableStream() { throw new Error('RSC browser decode is only available in the client environment') }
435export function createFromFetch() { throw new Error('RSC browser decode is only available in the client environment') }`
436 content[rscPaths.rscSsrDecode] = isServerEnv
437 ? `export { setOnClientReference, createFromReadableStream } from '@tanstack/react-start/rsbuild/ssr-decode'`
438 : `export function setOnClientReference() {}
439export function createFromReadableStream() { throw new Error('RSC SSR decode is only available in the server environment') }`
440 }
441β
442 return content
443 }
444β
445 // Build a map from virtual module IDs to their virtual file paths.
446 // Scheme-like IDs are rewritten with NormalModuleReplacementPlugin because
447 // rspack validates request schemes before normal alias resolution.
448 const aliasMap: Record<string, string> = {
449 [VIRTUAL_MODULES.startManifest]: paths.manifest,
450 [VIRTUAL_MODULES.serverFnResolver]: paths.serverFnResolver,
451 }
452β
453 if (hasSerializationAdapters) {
454 aliasMap[VIRTUAL_MODULES.pluginAdapters] = paths.pluginAdapters
455 }
456β
457 // Add RSC virtual module aliases
458 if (rscPaths) {
459 aliasMap[RSC_RUNTIME_VIRTUAL_ID] = rscPaths.rscRuntime
460 aliasMap[RSC_HMR_VIRTUAL_ID] = rscPaths.rscHmr
461 aliasMap[RSC_BROWSER_DECODE_VIRTUAL_ID] = rscPaths.rscBrowserDecode
462 aliasMap[RSC_SSR_DECODE_VIRTUAL_ID] = rscPaths.rscSsrDecode
463 }
464β
465 // Register VirtualModulesPlugin per environment via modifyRspackConfig
466 api.modifyRspackConfig((config, utils) => {
467 const envName = utils.environment.name
468 const initialContent = getInitialContent(envName)
469β
470 // Create VirtualModulesPlugin instance
471 const VMP = utils.rspack.experiments.VirtualModulesPlugin
472 const vmPlugin = new VMP(initialContent)
473 vmPlugins[envName] = vmPlugin
474 readyVmPlugins[envName] = false
475 config.plugins.push(vmPlugin)
476 config.plugins.push({
477 apply(compiler: {
478 hooks: {
479 thisCompilation: { tap: (name: string, handler: () => void) => void }
480 }
481 }) {
482 compiler.hooks.thisCompilation.tap(
483 'TanStackStartFlushPendingVirtualModules',
484 () => {
485 readyVmPlugins[envName] = true
486 flushPendingWrites(envName)
487 },
488 )
489 },
490 })
491β
492 // Rewrite scheme-like IDs to the VirtualModulesPlugin-backed file paths.
493 for (const [moduleId, virtualFilePath] of Object.entries(aliasMap)) {
494 const NMR = utils.rspack.NormalModuleReplacementPlugin
495 config.plugins.push(
496 new NMR(new RegExp(`^${escapeRegExp(moduleId)}$`), virtualFilePath),
497 )
498 }
499β
500 const resolve = config.resolve
501 const resolveAlias = (resolve.alias ??= {}) as Record<string, string>
502 resolveAlias[VIRTUAL_MODULES.serverFnResolver] = paths.serverFnResolver
503 if (hasSerializationAdapters) {
504 resolveAlias[VIRTUAL_MODULES.pluginAdapters] = paths.pluginAdapters
505 }
506β
507 // Add RSC-specific resolve aliases
508 if (rscPaths) {
509 resolveAlias[RSC_RUNTIME_VIRTUAL_ID] = rscPaths.rscRuntime
510 resolveAlias[RSC_HMR_VIRTUAL_ID] = rscPaths.rscHmr
511 resolveAlias[RSC_BROWSER_DECODE_VIRTUAL_ID] = rscPaths.rscBrowserDecode
512 resolveAlias[RSC_SSR_DECODE_VIRTUAL_ID] = rscPaths.rscSsrDecode
513 }
514 })
515β
516 return {
517 serverFnResolverPath: paths.serverFnResolver,
518 manifestPath: paths.manifest,
519 vmPlugins,
520β
521 generateCurrentResolverContent(forProvider?: boolean): string {
522 return generateResolverContent(
523 forProvider ? opts.providerEnvName : RSBUILD_ENVIRONMENT_NAMES.server,
524 )
525 },
526β
527 generateManifestContent(newClientBuild: NormalizedClientBuild): string {
528 const { resolvedStartConfig, startConfig } = opts.getConfig()
529 const devClientEntryUrl = opts.getDevClientEntryUrl(
530 resolvedStartConfig.basePaths.publicBase,
531 )
532 return generateManifestModuleBuild(
533 newClientBuild,
534 resolvedStartConfig.basePaths.publicBase,
535 devClientEntryUrl,
536 !isDev
537 ? startConfig.server.build.inlineCss
538 : { enabled: false, transformAssets: false },
539 opts.scriptFormat,
540 )
541 },
542β
543 generateManifestValueLiteral(
544 newClientBuild: NormalizedClientBuild,
545 ): string {
546 const { resolvedStartConfig, startConfig } = opts.getConfig()
547 return serializeStartManifestData(
548 newClientBuild,
549 resolvedStartConfig.basePaths.publicBase,
550 !isDev
551 ? startConfig.server.build.inlineCss
552 : { enabled: false, transformAssets: false },
553 opts.scriptFormat,
554 )
555 },
556β
557 updateManifest(newClientBuild: NormalizedClientBuild) {
558 clientBuild = newClientBuild
559 // Safe to call getConfig() here β runs after client build
560 const { resolvedStartConfig } = opts.getConfig()
561 if (isDev) {
562 ;(
563 globalThis as typeof globalThis & {
564 [DEV_START_MANIFEST_GLOBAL]?: ReturnType<typeof buildStartManifest>
565 }
566 )[DEV_START_MANIFEST_GLOBAL] = buildStartManifestData(
567 clientBuild,
568 resolvedStartConfig.basePaths.publicBase,
569 { enabled: false, transformAssets: false },
570 opts.scriptFormat,
571 )
572 }
573 },
574β
575 updateServerFnResolver() {
576 const updateEnvironment = (environmentName: string) => {
577 if (!needsServerFnResolver(environmentName)) {
578 return
579 }
580β
581 writeResolverContent(
582 environmentName,
583 generateResolverContent(environmentName),
584 )
585 }
586β
587 updateEnvironment(RSBUILD_ENVIRONMENT_NAMES.server)
588 if (hasSeparateProviderEnvironment) {
589 updateEnvironment(opts.providerEnvName)
590 }
591 },
592β
593 tryUpdateServerFnResolver(content: string) {
594 lastResolverContentByEnvironment[RSBUILD_ENVIRONMENT_NAMES.server] =
595 content
596 tryWriteModule(
597 RSBUILD_ENVIRONMENT_NAMES.server,
598 paths.serverFnResolver,
599 content,
600 )
601 },
602β
603 getVirtualPath(moduleId: string): string {
604 return virtualPath(root, moduleId)
605 },
606 }
607}