Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小浣熊撸代码
uni-app
提交
82dac631
U
uni-app
项目概览
小浣熊撸代码
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
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
...
@@ -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
WebpackUniMPPlugin
=
require
(
'
@dcloudio/webpack-uni-mp-loader/lib/plugin/index-new
'
)
const
onErrors
=
require
(
'
@dcloudio/vue-cli-plugin-uni/util/on-errors
'
)
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
cssLoaders
=
require
(
'
./css-loader.conf
'
)
const
vueLoaderOptions
=
require
(
'
./vue-loader.conf
'
)
const
vueLoaderOptions
=
require
(
'
./vue-loader.conf
'
)
...
@@ -65,7 +66,8 @@ const plugins = [
...
@@ -65,7 +66,8 @@ const plugins = [
}),
}),
new
webpack
.
ProvidePlugin
(
provide
),
new
webpack
.
ProvidePlugin
(
provide
),
new
WebpackErrorsPlugin
({
new
WebpackErrorsPlugin
({
onErrors
onErrors
,
onWarnings
}),
}),
new
WebpackAppPlusNVuePlugin
()
new
WebpackAppPlusNVuePlugin
()
]
]
...
@@ -192,12 +194,12 @@ module.exports = function () {
...
@@ -192,12 +194,12 @@ module.exports = function () {
},
},
externals
:
{
externals
:
{
'
vue
'
:
'
Vue
'
'
vue
'
:
'
Vue
'
},
},
performance
:
{
performance
:
{
hints
:
false
hints
:
false
},
},
optimization
:
{
optimization
:
{
namedModules
:
false
namedModules
:
false
},
},
output
:
{
output
:
{
path
:
process
.
env
.
UNI_OUTPUT_DIR
,
path
:
process
.
env
.
UNI_OUTPUT_DIR
,
...
...
packages/vue-cli-plugin-uni/lib/configure-webpack.js
浏览文件 @
82dac631
...
@@ -190,9 +190,10 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
...
@@ -190,9 +190,10 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
if
(
runByHBuilderX
)
{
// 使用 HBuilderX 中运行时,调整错误日志输出
if
(
runByHBuilderX
)
{
// 使用 HBuilderX 中运行时,调整错误日志输出
const
WebpackErrorsPlugin
=
require
(
'
../packages/webpack-errors-plugin
'
)
const
WebpackErrorsPlugin
=
require
(
'
../packages/webpack-errors-plugin
'
)
const
onErrors
=
require
(
'
../util/on-errors
'
)
const
onErrors
=
require
(
'
../util/on-errors
'
)
const
onWarnings
=
require
(
'
../util/on-warnings
'
)
plugins
.
push
(
new
WebpackErrorsPlugin
({
plugins
.
push
(
new
WebpackErrorsPlugin
({
onErrors
,
onErrors
,
onWarnings
:
onErrors
onWarnings
}))
}))
}
}
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
82dac631
...
@@ -148,16 +148,9 @@ if (
...
@@ -148,16 +148,9 @@ if (
platformOptions
.
uniStatistics
||
{}
platformOptions
.
uniStatistics
||
{}
)
)
if
(
if
(
uniStatistics
.
enable
!==
false
)
{
uniStatistics
.
enable
!==
false
&&
process
.
env
.
UNI_USING_STAT
=
true
(
if
(
!
process
.
UNI_STAT_CONFIG
.
appid
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
process
.
env
.
NODE_ENV
===
'
production
'
||
uniStatistics
.
enable
===
'
development
'
)
)
{
if
(
process
.
UNI_STAT_CONFIG
.
appid
)
{
process
.
env
.
UNI_USING_STAT
=
true
}
else
{
console
.
log
()
console
.
log
()
console
.
warn
(
`当前应用未配置Appid,无法使用uni统计,详情参考:https://ask.dcloud.net.cn/article/36303`
)
console
.
warn
(
`当前应用未配置Appid,无法使用uni统计,详情参考:https://ask.dcloud.net.cn/article/36303`
)
console
.
log
()
console
.
log
()
...
...
packages/vue-cli-plugin-uni/util/on-errors.js
浏览文件 @
82dac631
const
path
=
require
(
'
path
'
)
const
stringify
=
require
(
'
./stringify
'
)
const
formatErrors
=
require
(
'
./format-errors
'
)
module
.
exports
=
function
(
errors
)
{
module
.
exports
=
function
(
errors
)
{
console
.
error
(
console
.
error
(
stringify
(
errors
))
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
'
)
)
}
}
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录