MCPcopy
hub / github.com/vitejs/vite / getModuleByUrl

Method getModuleByUrl

packages/vite/src/node/server/mixedModuleGraph.ts:326–339  ·  view source on GitHub ↗
(
    url: string,
    _ssr?: boolean,
  )

Source from the content-addressed store, hash-verified

324 }
325
326 async getModuleByUrl(
327 url: string,
328 _ssr?: boolean,
329 ): Promise<ModuleNode | undefined> {
330 // In the mixed graph, the ssr flag was used to resolve the id.
331 const [clientModule, ssrModule] = await Promise.all([
332 this._client.getModuleByUrl(url),
333 this._ssr.getModuleByUrl(url),
334 ])
335 if (!clientModule && !ssrModule) {
336 return
337 }
338 return this.getBackwardCompatibleModuleNodeDual(clientModule, ssrModule)
339 }
340
341 getModulesByFile(file: string): Set<ModuleNode> | undefined {
342 // Until Vite 5.1.x, the moduleGraph contained modules from both the browser and server

Callers 10

server-hmr.spec.tsFile · 0.45
onFileAddUnlinkFunction · 0.45
transformRequestFunction · 0.45
doTransformFunction · 0.45
devHtmlHookFunction · 0.45
transformMiddlewareFunction · 0.45
configureServerFunction · 0.45
html.spec.tsFile · 0.45

Tested by

no test coverage detected