Skip to content

Commit 0fec884

Browse files
committed
fix: async import template (resolves #223, resolves #225)
1 parent 739d514 commit 0fec884

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

templates/components/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { wrapFunctional } from './utils'
88
].filter(Boolean).join(', ')
99
if (c.isAsync) {
1010
const exp = c.export === 'default' ? `c.default || c` : `c['${c.export}']`
11-
const asyncImport = `import('../${relativeToBuild(c.filePath)}' /* ${magicComments} */).then(c => wrapFunctional(${exp}))`
11+
const asyncImport = `() => import('../${relativeToBuild(c.filePath)}' /* ${magicComments} */).then(c => wrapFunctional(${exp}))`
1212
return `export const ${c.pascalName} = ${asyncImport}`
1313
} else {
1414
const exp = c.export === 'default' ? `default as ${c.pascalName}` : c.pascalName

templates/components/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import * as components from './index'
33

44
for (const name in components) {
55
Vue.component(name, components[name])
6-
Vue.component('Lazy' + name, () => Promise.resolve(components[name]))
6+
Vue.component('Lazy' + name, components[name])
77
}

0 commit comments

Comments
 (0)