From 2d1e742142e869fd07a6766353b58aa4861adf91 Mon Sep 17 00:00:00 2001 From: tanhauhau Date: Mon, 22 Apr 2024 17:00:25 +0800 Subject: [PATCH] fix: import path --- packages/playwright-ct-core/src/viteUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/playwright-ct-core/src/viteUtils.ts b/packages/playwright-ct-core/src/viteUtils.ts index 505301c48e..28cdded872 100644 --- a/packages/playwright-ct-core/src/viteUtils.ts +++ b/packages/playwright-ct-core/src/viteUtils.ts @@ -183,8 +183,8 @@ export function transformIndexFile(id: string, content: string, templateDir: str lines.push(registerSource); for (const value of importInfos.values()) { - const importPath = resolveHook(value.filename, value.importSource); - lines.push(`const ${value.id} = () => import('${importPath?.replaceAll(path.sep, '/')}').then((mod) => mod.${value.remoteName || 'default'});`); + const importPath = resolveHook(value.filename, value.importSource) ?? value.importSource; + lines.push(`const ${value.id} = () => import('${importPath.replaceAll(path.sep, '/')}').then((mod) => mod.${value.remoteName || 'default'});`); } lines.push(`__pwRegistry.initialize({ ${[...importInfos.keys()].join(',\n ')} });`);