Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
smallfawn authored Jun 28, 2024
1 parent effdc78 commit a5b2913
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ const plugins = [
];

for (let plugin of plugins) {
const code = plugin.plugin(sourceCode);
if (code && code !== processedCode) {
processedCode = code;
pluginUsed = plugin.name;
break;
try {
const code = plugin.plugin(sourceCode);
if (code && code !== processedCode) {
processedCode = code;
pluginUsed = plugin.name;
break;
}
} catch (error) {
console.error(`插件 ${plugin.name} 处理时发生错误: ${error.message}`);
// 继续循环尝试下一个插件
continue;
}
}

Expand Down

0 comments on commit a5b2913

Please sign in to comment.