From 44abecdbbfe36c54ac39f5ad7b33a833f17f303d Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 16 Sep 2021 04:41:21 +0800 Subject: [PATCH] chore: update --- src/types.ts | 2 +- templates/components/index.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index b8dc6b6..6ded9bd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -7,7 +7,7 @@ export interface Component { filePath: string shortPath: string isAsync?: boolean - isAbsolute?: boolean + resolvePath?: boolean chunkName: string /** @deprecated */ global: boolean diff --git a/templates/components/index.js b/templates/components/index.js index e19b49d..4171b0f 100644 --- a/templates/components/index.js +++ b/templates/components/index.js @@ -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}))`