fix: 视觉夹具校验容忍缺失 npm 构建产物

This commit is contained in:
que01 committed 2026-10-21 12:17:11 +08:00
1 parent 71c068966e
commit b86c661af5
1 file changed
+6 -5
@@ -93,6 +93,7 @@ function validateManifestOutput(manifest, output, otherComponentNames) {
}
}
const hasNpm = fs.existsSync(path.join(output, "miniprogram_npm"));
for (const file of listFiles(output)) {
if (!/\.(js|json|wxml)$/.test(file)) continue;
const source = fs.readFileSync(path.join(output, file), "utf8");
@@ -106,11 +107,11 @@ function validateManifestOutput(manifest, output, otherComponentNames) {
}
for (const [name, reference] of Object.entries(definition.usingComponents || {})) {
if (reference.startsWith("plugin://")) continue;
if (
reference.startsWith("/miniprogram_npm/") &&
!fs.existsSync(path.join(output, "miniprogram_npm"))
)
continue;
// miniprogram_npm 由微信开发者工具生成且不入库;缺失时跳过 npm 组件解析检查。
const needsNpm =
reference.startsWith("/miniprogram_npm/") ||
(!reference.startsWith("/") && !reference.startsWith("."));
if (needsNpm && !hasNpm) continue;
if (!resolveComponent(output, file, reference))
failures.push(`${file}: component ${name} cannot be resolved (${reference})`);
}