Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ripplebb
uni-app
提交
35ab3d58
U
uni-app
项目概览
ripplebb
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
35ab3d58
编写于
3月 04, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(cli): remove duplicate log
上级
acd7e645
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
14 deletion
+59
-14
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
+6
-3
packages/vue-cli-plugin-hbuilderx/packages/webpack-app-plus-plugin/index.js
...lugin-hbuilderx/packages/webpack-app-plus-plugin/index.js
+36
-11
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/plugin/index.js
...lugin-uni/packages/webpack-uni-app-loader/plugin/index.js
+17
-0
未找到文件。
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
浏览文件 @
35ab3d58
...
...
@@ -12,7 +12,10 @@ const {
getTemplatePath
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
WebpackAppPlusNVuePlugin
=
require
(
'
../packages/webpack-app-plus-nvue-plugin
'
)
const
WebpackAppPlusNVuePlugin
=
process
.
env
.
UNI_USING_V3
?
require
(
'
../packages/webpack-app-plus-plugin
'
)
:
require
(
'
../packages/webpack-app-plus-nvue-plugin
'
)
const
WebpackErrorsPlugin
=
require
(
'
@dcloudio/vue-cli-plugin-uni/packages/webpack-errors-plugin
'
)
const
WebpackUniMPPlugin
=
require
(
'
@dcloudio/webpack-uni-mp-loader/lib/plugin/index-new
'
)
...
...
@@ -72,8 +75,8 @@ const plugins = [
new
webpack
.
DefinePlugin
({
'
process.env
'
:
{
'
NODE_ENV
'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
'
VUE_APP_PLATFORM
'
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
),
'
UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
VUE_APP_PLATFORM
'
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
),
'
UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
HBX_USER_TOKEN
'
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
)
}
}),
...
...
packages/vue-cli-plugin-hbuilderx/packages/webpack-app-plus-plugin/index.js
浏览文件 @
35ab3d58
...
...
@@ -6,14 +6,18 @@ const {
done
}
=
require
(
'
@vue/cli-shared-utils
'
)
let
nvueCompiled
=
true
let
serviceCompiled
=
true
let
viewCompiled
=
true
const
nvueChangedFiles
=
[]
const
serviceChangedFiles
=
[]
const
viewChangedFiles
=
[]
let
isFirst
=
true
let
compiling
=
false
class
WebpackAppPlusPlugin
{
apply
(
compiler
)
{
if
(
process
.
env
.
UNI_USING_V3
)
{
...
...
@@ -21,20 +25,27 @@ class WebpackAppPlusPlugin {
const
chunkVersions
=
{}
const
entry
=
compiler
.
options
.
entry
()
const
isAppService
=
entry
[
'
app-service
'
]
const
isAppView
=
entry
[
'
app-view
'
]
const
isAppService
=
!!
entry
[
'
app-service
'
]
const
isAppView
=
!!
entry
[
'
app-view
'
]
const
isAppNVue
=
!
isAppService
&&
!
isAppView
compiler
.
hooks
.
invalid
.
tap
(
'
WebpackAppPlusPlugin
'
,
(
fileName
,
changeTime
)
=>
{
if
(
!
compiling
)
{
compiling
=
true
console
.
log
(
'
开始差量编译...
'
)
}
})
compiler
.
hooks
.
beforeCompile
.
tapAsync
(
'
WebpackAppPlusPlugin
'
,
(
params
,
callback
)
=>
{
isAppNVue
&&
(
nvueCompiled
=
false
)
isAppService
&&
(
serviceCompiled
=
false
)
isAppView
&&
(
viewCompiled
=
false
)
callback
()
})
compiler
.
hooks
.
emit
.
tapAsync
(
'
WebpackAppPlusPlugin
'
,
(
compilation
,
callback
)
=>
{
isAppService
&&
(
serviceChangedFiles
.
length
=
0
)
isAppView
&&
(
viewChangedFiles
.
length
=
0
)
const
changedChunks
=
compilation
.
chunks
.
filter
(
chunk
=>
{
const
oldVersion
=
chunkVersions
[
chunk
.
name
]
chunkVersions
[
chunk
.
name
]
=
chunk
.
hash
...
...
@@ -47,6 +58,8 @@ class WebpackAppPlusPlugin {
!
serviceChangedFiles
.
includes
(
file
)
&&
(
serviceChangedFiles
.
push
(
file
))
}
else
if
(
isAppView
)
{
!
viewChangedFiles
.
includes
(
file
)
&&
(
viewChangedFiles
.
push
(
file
))
}
else
if
(
isAppNVue
)
{
!
nvueChangedFiles
.
includes
(
file
)
&&
(
nvueChangedFiles
.
push
(
file
))
}
})
}
...
...
@@ -56,14 +69,23 @@ class WebpackAppPlusPlugin {
compiler
.
hooks
.
done
.
tapPromise
(
'
WebpackAppPlusPlugin
'
,
compilation
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
isAppNVue
&&
(
nvueCompiled
=
true
)
isAppService
&&
(
serviceCompiled
=
true
)
isAppView
&&
(
viewCompiled
=
true
)
if
(
serviceCompiled
&&
viewCompiled
)
{
const
changedFiles
=
[...
new
Set
([...
serviceChangedFiles
,
...
viewChangedFiles
])]
if
(
serviceCompiled
&&
viewCompiled
&&
nvueCompiled
)
{
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
const
changedFiles
=
[...
new
Set
([
...
serviceChangedFiles
,
...
viewChangedFiles
,
...
nvueChangedFiles
])]
if
(
!
isFirst
&&
changedFiles
.
length
>
0
)
{
done
(
`Build complete. FILES:`
+
JSON
.
stringify
(
changedFiles
))
if
(
serviceChangedFiles
.
length
===
0
&&
viewChangedFiles
.
length
===
0
)
{
// 仅 nvue 页面发生变化
done
(
`Build complete. PAGES:`
+
JSON
.
stringify
(
changedFiles
))
}
else
{
done
(
`Build complete. FILES:`
+
JSON
.
stringify
(
changedFiles
))
}
}
else
{
done
(
`Build complete. Watching for changes...`
)
}
...
...
@@ -71,8 +93,11 @@ class WebpackAppPlusPlugin {
}
else
{
done
(
`Build complete. `
)
}
nvueChangedFiles
.
length
=
0
serviceChangedFiles
.
length
=
0
viewChangedFiles
.
length
=
0
compiling
=
false
}
resolve
()
})
})
...
...
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/plugin/index.js
浏览文件 @
35ab3d58
...
...
@@ -8,6 +8,8 @@ const {
initAutoImportScanComponents
}
=
require
(
'
@dcloudio/uni-cli-shared/lib/pages
'
)
let
compiling
=
false
class
WebpackUniAppPlugin
{
apply
(
compiler
)
{
if
(
process
.
UNI_CONFUSION
)
{
...
...
@@ -32,6 +34,12 @@ class WebpackUniAppPlugin {
}
compiler
.
hooks
.
invalid
.
tap
(
'
webpack-uni-app-invalid
'
,
(
fileName
,
changeTime
)
=>
{
if
(
!
process
.
env
.
UNI_USING_V3
)
{
if
(
!
compiling
)
{
compiling
=
true
console
.
log
(
'
开始差量编译...
'
)
}
}
if
(
fileName
&&
typeof
fileName
===
'
string
'
)
{
if
(
fileName
.
indexOf
(
'
.vue
'
)
!==
-
1
||
fileName
.
indexOf
(
'
.nvue
'
)
!==
-
1
)
{
if
(
process
.
UNI_AUTO_SCAN_COMPONENTS
)
{
...
...
@@ -40,6 +48,15 @@ class WebpackUniAppPlugin {
}
}
})
// v3 版本在webpack-app-plus-plugin/index.js中处理,目前太乱了。后续要整理
if
(
!
process
.
env
.
UNI_USING_V3
)
{
compiler
.
hooks
.
done
.
tapPromise
(
'
webpack-uni-app-done
'
,
compilation
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
compiling
=
false
resolve
()
})
})
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录