fix(vite): pass ssr condition to getModuleByUrl (#7260)

This commit is contained in:
Daniel Roe 2022-09-05 21:52:14 +01:00 committed by GitHub
parent 497972be5d
commit d115b01a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,7 @@ export async function warmupViteServer (
} catch (e) { } catch (e) {
logger.debug('Warmup for %s failed with: %s', url, e) logger.debug('Warmup for %s failed with: %s', url, e)
} }
const mod = await server.moduleGraph.getModuleByUrl(url) const mod = await server.moduleGraph.getModuleByUrl(url, isServer)
const deps = Array.from(mod?.importedModules || []) const deps = Array.from(mod?.importedModules || [])
await Promise.all(deps.map(m => warmup(m.url.replace('/@id/__x00__', '\0')))) await Promise.all(deps.map(m => warmup(m.url.replace('/@id/__x00__', '\0'))))
} }