mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nitro): show all ERR_MODULE_NOT_FOUND errors (#561)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
0c14b0a48b
commit
f06ee66f1c
@ -15,10 +15,10 @@ const getSSRApp = cachedImport(() => import('#build/dist/server/server.mjs'))
|
||||
const getSSRRenderer = cachedResult(async () => {
|
||||
// Load client manifest
|
||||
const clientManifest = await getClientManifest()
|
||||
if (!clientManifest) { throw new Error('client.manifest is missing') }
|
||||
if (!clientManifest) { throw new Error('client.manifest is not available') }
|
||||
// Load server bundle
|
||||
const createSSRApp = await getSSRApp()
|
||||
if (!createSSRApp) { throw new Error('Server bundle is missing') }
|
||||
if (!createSSRApp) { throw new Error('Server bundle is not available') }
|
||||
// Create renderer
|
||||
const { renderToString } = await import('#nitro-renderer')
|
||||
return createRenderer((createSSRApp), { clientManifest, renderToString, publicPath: clientManifest.publicPath || '/_nuxt' }).renderToString
|
||||
@ -141,10 +141,7 @@ function _interopDefault (e) {
|
||||
}
|
||||
|
||||
function cachedImport <M> (importer: () => Promise<M>) {
|
||||
return cachedResult(() => importer().then(_interopDefault).catch((err) => {
|
||||
if (err.code === 'ERR_MODULE_NOT_FOUND') { return null }
|
||||
throw err
|
||||
}))
|
||||
return cachedResult(() => importer().then(_interopDefault))
|
||||
}
|
||||
|
||||
function cachedResult <T> (fn: () => Promise<T>): () => Promise<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user