const fs = require('fs'); let sfc; try { sfc = require('@vue/compiler-sfc'); } catch (e) { try { sfc = require('D:/Softwares/phpstudy_pro/WWW/fenleixinxi/uniapp/node_modules/@vue/compiler-sfc'); } catch (e2) { console.log("No compiler-sfc found locally, skip"); } } if (sfc && sfc.parse) { ['uniapp/pages/member/index.vue', 'uniapp/pages/member/recharge.vue'].forEach(f => { const res = sfc.parse(fs.readFileSync(f, 'utf8')); if (res.errors && res.errors.length) { console.error(f, res.errors); } else { console.log(f, "PARSED_OK"); } }); }