fix(cli): entry生成路径错误问题

This commit is contained in:
kevinyzheng 2022-11-08 11:27:48 +08:00 committed by roymondchen
parent 04e18572fd
commit f5a8d6bdc6

View File

@ -419,10 +419,11 @@ const getASTTokenByTraverse = ({ ast, indexPath }: { ast: any; indexPath: string
});
Object.keys(exportSpecifiersMap).forEach((exportName) => {
const filePath = path.resolve(
path.dirname(indexPath),
exportSpecifiersMap[exportName] || importSpecifiersMap[exportName] || '',
);
const exportValue = exportSpecifiersMap[exportName];
const importValue = importSpecifiersMap[exportName];
const connectValue = exportValue ? importSpecifiersMap[exportValue] : '';
const filePath = path.resolve(path.dirname(indexPath), connectValue || importValue || exportValue || '');
if (exportName === EntryType.VALUE) {
value = filePath;
} else if (exportName === EntryType.CONFIG) {