fix: 视觉夹具校验容忍缺失 npm 构建产物
This commit is contained in:
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)) {
|
for (const file of listFiles(output)) {
|
||||||
if (!/\.(js|json|wxml)$/.test(file)) continue;
|
if (!/\.(js|json|wxml)$/.test(file)) continue;
|
||||||
const source = fs.readFileSync(path.join(output, file), "utf8");
|
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 || {})) {
|
for (const [name, reference] of Object.entries(definition.usingComponents || {})) {
|
||||||
if (reference.startsWith("plugin://")) continue;
|
if (reference.startsWith("plugin://")) continue;
|
||||||
if (
|
// miniprogram_npm 由微信开发者工具生成且不入库;缺失时跳过 npm 组件解析检查。
|
||||||
reference.startsWith("/miniprogram_npm/") &&
|
const needsNpm =
|
||||||
!fs.existsSync(path.join(output, "miniprogram_npm"))
|
reference.startsWith("/miniprogram_npm/") ||
|
||||||
)
|
(!reference.startsWith("/") && !reference.startsWith("."));
|
||||||
continue;
|
if (needsNpm && !hasNpm) continue;
|
||||||
if (!resolveComponent(output, file, reference))
|
if (!resolveComponent(output, file, reference))
|
||||||
failures.push(`${file}: component ${name} cannot be resolved (${reference})`);
|
failures.push(`${file}: component ${name} cannot be resolved (${reference})`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user