Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 15, 2021
1 parent 2e60935 commit 44abecd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface Component {
filePath: string
shortPath: string
isAsync?: boolean
isAbsolute?: boolean
resolvePath?: boolean
chunkName: string
/** @deprecated */
global: boolean
Expand Down
4 changes: 3 additions & 1 deletion templates/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
c.prefetch === true || typeof c.prefetch === 'number' ? `webpackPrefetch: ${c.prefetch}` : false,
c.preload === true || typeof c.preload === 'number' ? `webpackPreload: ${c.preload}` : false,
].filter(Boolean).join(', ')
const filePath = c.isAbsolute ? c.filePath : `../${relativeToBuild(c.filePath)}`
const filePath = (c.resolvePath === false || ['~', '@'].includes(c.filePath[0]))
? c.filePath
: `../${relativeToBuild(c.filePath)}`
if (c.isAsync === true || (!isDev /* prod fallback */ && c.isAsync === null)) {
const exp = c.export === 'default' ? `c.default || c` : `c['${c.export}']`
const asyncImport = `() => import('${filePath}' /* ${magicComments} */).then(c => wrapFunctional(${exp}))`
Expand Down

0 comments on commit 44abecd

Please sign in to comment.