提交 96d745ad 编写于 作者: fxy060608's avatar fxy060608

feat: auto install plugin

上级 951021ce
......@@ -78,9 +78,12 @@ function ModuleBuildError (err) {
builtinCompile = 'pug/jade'
}
if (builtinCompile) {
const autoInstall = supportAutoInstallPlugin()
autoInstall && sendSignal(name)
return {
message: '预编译器错误:代码使用了' + builtinCompile +
'语言,但未安装相应的编译器插件,请前往插件市场安装该插件:\nhttps://ext.dcloud.net.cn/plugin?name=' + name
'语言,但未安装相应的编译器插件,' + (autoInstall ? '正在从' : '请前往') + '插件市场安装该插件:\nhttps://ext.dcloud.net.cn/plugin?name=' +
name
}
}
} else if (~firstLineMessage.indexOf('Module parse failed')) {
......@@ -94,6 +97,18 @@ function ModuleBuildError (err) {
return formatMessage(err.message)
}
function supportAutoInstallPlugin () {
return false
}
function sendSignal (lang) {
if (supportAutoInstallPlugin()) {
return console.error(
`%HXRunUniAPPPluginName%${lang}%HXRunUniAPPPluginName%`
)
}
}
function ModuleNotFoundError (err) {
const matches = err.message.match(/Can't resolve '(.*loader)'/)
if (matches && matches.length > 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册