Open stathamcheng opened 1 year ago
let findDir = function (dir, oldDir) { let files = fs.readdirSync(dir); for (const file of files) { let workDir = path.join(dir, file); //此处workDir不是文件夹会导致fs.readdirSync(dir)抛异常,未考虑其处理逻辑 if (fs.existsSync(path.resolve(workDir, "app-service.js"))) { console.log("sub package word dir: " + workDir); mainDir = path.resolve(oldDir, mainDir); console.log("real mainDir: " + mainDir); dealThreeThings(workDir, mainDir, oldDir); doSubPkg = true; return true; } else { findDir(workDir, oldDir); } } };
而且,如果遍历完成后仍未 满足 if (fs.existsSync(path.resolve(workDir, "app-service.js"))) 条件,将会抛178行ERROR:(throw new Error("检测到此包是分包后的子包, 请通过 -s 参数指定存放路径后重试, 如 node wuWxapkg.js -s=/xxx/xxx ./testpkg/test-pkg-sub.wxapkg");)