Skip to content

Commit

Permalink
fix(uts): 优化 uts插件编译,避免同一个插件在一个编译流程里编译多次
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Jan 11, 2025
1 parent dd1bdbe commit c454973
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/uni-cli-shared/src/vite/plugins/uts/uni_modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,15 @@ export function uniUTSAppUniModulesPlugin(
)
if (deps.length) {
for (const dep of deps) {
await compilePlugin(path.resolve(inputDir, 'uni_modules', dep))
if (dep) {
// 本次编译流程中已编译过该插件,直接使用缓存
const depPluginDir = normalizePath(path.resolve(uniModulesDir, dep))
if (utsModuleCaches.get(depPluginDir)) {
await utsModuleCaches.get(depPluginDir)!()
} else {
await compilePlugin(path.resolve(inputDir, 'uni_modules', dep))
}
}
}
}

Expand Down

0 comments on commit c454973

Please sign in to comment.