提交 8b8bbfc0 编写于 作者: fxy060608's avatar fxy060608

fix(cli): show preprocessor tips once

上级 113a9f92
......@@ -23,10 +23,14 @@ function parseUniExtApis(vite = true) {
if (!fs_extra_1.default.existsSync(pkgPath)) {
return;
}
try {
const exports = (_b = (_a = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8'))) === null || _a === void 0 ? void 0 : _a.uni_modules) === null || _b === void 0 ? void 0 : _b['uni-ext-api'];
if (exports) {
Object.assign(injects, parseInjects(vite, process.env.UNI_PLATFORM === 'h5' ? 'web' : process.env.UNI_PLATFORM, `@/uni_modules/${uniModuleDir}`, exports));
}
}
catch (e) {
}
});
return injects;
}
......
......@@ -20,6 +20,8 @@ function formatMessage (msg) {
return ''
}
const installPreprocessorTips = {}
function ModuleBuildError (err) {
const lines = err.message.split('\n')
let firstLineMessage = lines[0]
......@@ -78,6 +80,10 @@ function ModuleBuildError (err) {
builtinCompile = 'pug/jade'
}
if (builtinCompile) {
if (installPreprocessorTips[name]) {
return false
}
installPreprocessorTips[name] = true
installHBuilderXPlugin(name)
return {
message: '预编译器错误:代码使用了' + builtinCompile +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册