fix(cli): 插件不支持ts的问题

This commit is contained in:
roymondchen 2022-12-07 18:52:12 +08:00
parent 328b3135e5
commit ccb4e675ab

View File

@ -63,7 +63,7 @@ export const resolveAppPackages = (app: App): ModuleMainFilePath => {
return;
}
const indexCode = fs.readFileSync(i.indexPath, { encoding: 'utf-8', flag: 'r' });
const ast = recast.parse(indexCode);
const ast = recast.parse(indexCode, { parser: require('recast/parsers/typescript') });
if (typeAssertion({ ast, indexPath }).type === PackageType.PLUGIN) {
// 插件
pluginMap[i.type] = i.indexPath;