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) => { Object.keys(exportSpecifiersMap).forEach((exportName) => {
const filePath = path.resolve( const exportValue = exportSpecifiersMap[exportName];
path.dirname(indexPath), const importValue = importSpecifiersMap[exportName];
exportSpecifiersMap[exportName] || importSpecifiersMap[exportName] || '', const connectValue = exportValue ? importSpecifiersMap[exportValue] : '';
); const filePath = path.resolve(path.dirname(indexPath), connectValue || importValue || exportValue || '');
if (exportName === EntryType.VALUE) { if (exportName === EntryType.VALUE) {
value = filePath; value = filePath;
} else if (exportName === EntryType.CONFIG) { } else if (exportName === EntryType.CONFIG) {