mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +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 () => {
|
const getSSRRenderer = cachedResult(async () => {
|
||||||
// Load client manifest
|
// Load client manifest
|
||||||
const clientManifest = await getClientManifest()
|
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
|
// Load server bundle
|
||||||
const createSSRApp = await getSSRApp()
|
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
|
// Create renderer
|
||||||
const { renderToString } = await import('#nitro-renderer')
|
const { renderToString } = await import('#nitro-renderer')
|
||||||
return createRenderer((createSSRApp), { clientManifest, renderToString, publicPath: clientManifest.publicPath || '/_nuxt' }).renderToString
|
return createRenderer((createSSRApp), { clientManifest, renderToString, publicPath: clientManifest.publicPath || '/_nuxt' }).renderToString
|
||||||
@ -141,10 +141,7 @@ function _interopDefault (e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cachedImport <M> (importer: () => Promise<M>) {
|
function cachedImport <M> (importer: () => Promise<M>) {
|
||||||
return cachedResult(() => importer().then(_interopDefault).catch((err) => {
|
return cachedResult(() => importer().then(_interopDefault))
|
||||||
if (err.code === 'ERR_MODULE_NOT_FOUND') { return null }
|
|
||||||
throw err
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cachedResult <T> (fn: () => Promise<T>): () => Promise<T> {
|
function cachedResult <T> (fn: () => Promise<T>): () => Promise<T> {
|
||||||
|
Loading…
Reference in New Issue
Block a user