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

Function importWithRetry

playground/environment-react-ssr/vite.config.ts:87–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85 hmr: { logger: false },
86 })
87 const importWithRetry = async () => {
88 try {
89 return await runner.import(entry)
90 } catch (e) {
91 if (
92 e instanceof Error &&
93 (e as any).code === 'ERR_OUTDATED_OPTIMIZED_DEP'
94 ) {
95 runner.clearCache()
96 return await importWithRetry()
97 }
98 throw e
99 }
100 }
101 const handler: Connect.NextHandleFunction = async (req, res, next) => {
102 try {
103 const mod = await importWithRetry()

Callers 1

handlerFunction · 0.85

Calls 2

importMethod · 0.80
clearCacheMethod · 0.80

Tested by

no test coverage detected