MCPcopy
hub / github.com/nuxt/nuxt / fetchModule

Function fetchModule

packages/vite/src/vite-node-runner.ts:16–38  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

14 return viteNodeFetch.resolveId(id, importer)
15 },
16 fetchModule (id) {
17 id = id.replace(/\/\//g, '/') // TODO: fix in vite-node
18 return viteNodeFetch.fetchModule(id).catch((err) => {
19 const errorData = err?.data
20 if (!errorData) {
21 throw err
22 }
23 let built: Error
24 try {
25 built = buildViteError(errorData, id)
26 } catch (buildErr) {
27 consola.warn('Internal nuxt error while formatting vite-node error. Please report this!', buildErr)
28 const message = `[vite-node] [TransformError] ${errorData?.message || '-'}`
29 consola.error(message, errorData)
30 built = Object.assign(new Error(message), {
31 statusText: 'Vite Error',
32 statusMessage: 'Vite Error',
33 stack: `${message}\nat ${id}\n` + (errorData?.stack || ''),
34 })
35 }
36 throw built
37 })
38 },
39 })
40}
41

Callers

nothing calls this directly

Calls 2

buildViteErrorFunction · 0.85
fetchModuleMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…