Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
luomor
uni-app
提交
82dac631
uni-app
项目概览
luomor
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82dac631
编写于
9月 12, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(cli): refactor errors and warnings
上级
a4ab2e33
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
82 addition
and
49 deletion
+82
-49
lib/h5/ui.js
lib/h5/ui.js
+24
-0
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
+7
-5
packages/vue-cli-plugin-uni/lib/configure-webpack.js
packages/vue-cli-plugin-uni/lib/configure-webpack.js
+2
-1
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+3
-10
packages/vue-cli-plugin-uni/util/on-errors.js
packages/vue-cli-plugin-uni/util/on-errors.js
+2
-33
packages/vue-cli-plugin-uni/util/on-warnings.js
packages/vue-cli-plugin-uni/util/on-warnings.js
+11
-0
packages/vue-cli-plugin-uni/util/stringify.js
packages/vue-cli-plugin-uni/util/stringify.js
+33
-0
未找到文件。
lib/h5/ui.js
0 → 100644
浏览文件 @
82dac631
import
Vue
from
'
vue
'
// 使用白名单过滤(前期有一批自定义组件使用了 uni-)
import
tags
from
'
uni-helpers/tags
'
const
oldIsReservedTag
=
Vue
.
config
.
isReservedTag
Vue
.
config
.
isReservedTag
=
function
(
tag
)
{
return
tags
.
indexOf
(
tag
)
!==
-
1
||
oldIsReservedTag
(
tag
)
}
Vue
.
config
.
ignoredElements
=
tags
const
oldGetTagNamespace
=
Vue
.
config
.
getTagNamespace
const
conflictTags
=
[
'
switch
'
,
'
image
'
,
'
text
'
,
'
view
'
]
Vue
.
config
.
getTagNamespace
=
function
(
tag
)
{
if
(
~
conflictTags
.
indexOf
(
tag
))
{
// svg 部分标签名称与 uni 标签冲突
return
false
}
return
oldGetTagNamespace
(
tag
)
||
false
}
require
(
'
uni-components
'
)
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
浏览文件 @
82dac631
...
...
@@ -15,6 +15,7 @@ const WebpackErrorsPlugin = require('@dcloudio/vue-cli-plugin-uni/packages/webpa
const
WebpackUniMPPlugin
=
require
(
'
@dcloudio/webpack-uni-mp-loader/lib/plugin/index-new
'
)
const
onErrors
=
require
(
'
@dcloudio/vue-cli-plugin-uni/util/on-errors
'
)
const
onWarnings
=
require
(
'
@dcloudio/vue-cli-plugin-uni/util/on-warnings
'
)
const
cssLoaders
=
require
(
'
./css-loader.conf
'
)
const
vueLoaderOptions
=
require
(
'
./vue-loader.conf
'
)
...
...
@@ -65,7 +66,8 @@ const plugins = [
}),
new
webpack
.
ProvidePlugin
(
provide
),
new
WebpackErrorsPlugin
({
onErrors
onErrors
,
onWarnings
}),
new
WebpackAppPlusNVuePlugin
()
]
...
...
packages/vue-cli-plugin-uni/lib/configure-webpack.js
浏览文件 @
82dac631
...
...
@@ -190,9 +190,10 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
if
(
runByHBuilderX
)
{
// 使用 HBuilderX 中运行时,调整错误日志输出
const
WebpackErrorsPlugin
=
require
(
'
../packages/webpack-errors-plugin
'
)
const
onErrors
=
require
(
'
../util/on-errors
'
)
const
onWarnings
=
require
(
'
../util/on-warnings
'
)
plugins
.
push
(
new
WebpackErrorsPlugin
({
onErrors
,
onWarnings
:
onErrors
onWarnings
}))
}
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
82dac631
...
...
@@ -148,16 +148,9 @@ if (
platformOptions
.
uniStatistics
||
{}
)
if
(
uniStatistics
.
enable
!==
false
&&
(
process
.
env
.
NODE_ENV
===
'
production
'
||
uniStatistics
.
enable
===
'
development
'
)
)
{
if
(
process
.
UNI_STAT_CONFIG
.
appid
)
{
if
(
uniStatistics
.
enable
!==
false
)
{
process
.
env
.
UNI_USING_STAT
=
true
}
else
{
if
(
!
process
.
UNI_STAT_CONFIG
.
appid
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
console
.
log
()
console
.
warn
(
`当前应用未配置Appid,无法使用uni统计,详情参考:https://ask.dcloud.net.cn/article/36303`
)
console
.
log
()
...
...
packages/vue-cli-plugin-uni/util/on-errors.js
浏览文件 @
82dac631
const
path
=
require
(
'
path
'
)
const
formatErrors
=
require
(
'
./format-errors
'
)
const
stringify
=
require
(
'
./stringify
'
)
module
.
exports
=
function
(
errors
)
{
console
.
error
(
Array
.
from
(
new
Set
(
errors
.
map
(
err
=>
{
const
formatError
=
formatErrors
[
err
.
name
]
if
(
formatError
)
{
const
result
=
formatError
(
err
)
if
(
result
)
{
if
(
typeof
result
===
'
string
'
)
{
return
result
}
else
{
const
file
=
path
.
relative
(
process
.
env
.
UNI_INPUT_DIR
,
err
.
module
.
resource
).
split
(
'
?
'
)[
0
]
if
(
file
===
'
pages.json
'
)
{
result
.
line
=
1
}
return
`
${
result
.
message
}
at
${
file
}
:
${
result
.
line
||
1
}
`
}
}
else
if
(
result
===
false
)
{
return
''
// skip
}
}
return
err
.
message
})
)
)
.
filter
(
msg
=>
!!
msg
)
.
join
(
'
\n
'
)
)
console
.
error
(
stringify
(
errors
))
}
packages/vue-cli-plugin-uni/util/on-warnings.js
0 → 100644
浏览文件 @
82dac631
const
stringify
=
require
(
'
./stringify
'
)
module
.
exports
=
function
(
errors
)
{
const
{
runByHBuilderX
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
if
(
runByHBuilderX
)
{
console
.
log
(
stringify
(
errors
))
}
else
{
console
.
warn
(
stringify
(
errors
))
}
}
packages/vue-cli-plugin-uni/util/stringify.js
0 → 100644
浏览文件 @
82dac631
const
path
=
require
(
'
path
'
)
const
formatErrors
=
require
(
'
./format-errors
'
)
module
.
exports
=
function
stringify
(
errors
)
{
return
(
Array
.
from
(
new
Set
(
errors
.
map
(
err
=>
{
const
formatError
=
formatErrors
[
err
.
name
]
if
(
formatError
)
{
const
result
=
formatError
(
err
)
if
(
result
)
{
if
(
typeof
result
===
'
string
'
)
{
return
result
}
else
{
const
file
=
path
.
relative
(
process
.
env
.
UNI_INPUT_DIR
,
err
.
module
.
resource
).
split
(
'
?
'
)[
0
]
if
(
file
===
'
pages.json
'
)
{
result
.
line
=
1
}
return
`
${
result
.
message
}
at
${
file
}
:
${
result
.
line
||
1
}
`
}
}
else
if
(
result
===
false
)
{
return
''
// skip
}
}
return
err
.
message
})
)
)
.
filter
(
msg
=>
!!
msg
)
.
join
(
'
\n
'
))
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录