fix: import path

This commit is contained in:
tanhauhau 2024-04-22 17:00:25 +08:00
parent 783d8d70d8
commit 2d1e742142

View file

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