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 ')} });`);