mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix: use Object.assign in async comp
This commit is contained in:
parent
f1d054c3c6
commit
d50da3c1a0
@ -75,7 +75,7 @@ export const loaderPlugin = createUnplugin((options: LoaderOptions) => {
|
|||||||
if (lazy) {
|
if (lazy) {
|
||||||
imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }]))
|
imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }]))
|
||||||
identifier += '_lazy'
|
identifier += '_lazy'
|
||||||
imports.add(`const ${identifier} = __defineAsyncComponent(${genDynamicImport(component.filePath, { interopDefault: false })}.then(c => ${options.isDev ? `({...(c.${component.export ?? 'default'} || c), name: ${JSON.stringify(component.pascalName)}})` : `c.${component.export ?? 'default'} || c`})${isClientOnly ? '.then(c => createClientOnly(c))' : ''})`)
|
imports.add(`const ${identifier} = __defineAsyncComponent(${genDynamicImport(component.filePath, { interopDefault: false })}.then(c => ${options.isDev ? `Object.assign(c.${component.export ?? 'default'} || c, {name: ${JSON.stringify(component.pascalName)}})` : `c.${component.export ?? 'default'} || c`})${isClientOnly ? '.then(c => createClientOnly(c))' : ''})`)
|
||||||
} else {
|
} else {
|
||||||
imports.add(genImport(component.filePath, [{ name: component._raw ? 'default' : component.export, as: identifier }]))
|
imports.add(genImport(component.filePath, [{ name: component._raw ? 'default' : component.export, as: identifier }]))
|
||||||
if (options.isDev) {
|
if (options.isDev) {
|
||||||
|
Loading…
Reference in New Issue
Block a user