fix(nitro): resolve default export for assets

This commit is contained in:
Pooya Parsa 2021-04-19 22:41:47 +02:00
parent 4e1865358c
commit 49e4c038b5

View File

@ -88,7 +88,7 @@ export function getAsset (id) {
} }
} }
const inlineAssets = `const assets = {\n${Object.keys(assets).map(id => const inlineAssets = `const assets = {\n${Object.keys(assets).map(id =>
` ['${id}']: {\n read: () => import('${assets[id].fsPath}'),\n meta: ${JSON.stringify(assets[id].meta)}\n }` ` ['${id}']: {\n read: () => import('${assets[id].fsPath}').then(r => r.default || r),\n meta: ${JSON.stringify(assets[id].meta)}\n }`
).join(',\n')}\n}` ).join(',\n')}\n}`
return `${inlineAssets}\n${assetUtils} return `${inlineAssets}\n${assetUtils}
export function getAsset (id) { export function getAsset (id) {