Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ChenYFan_OHHH
uni-app
提交
5f6838dc
U
uni-app
项目概览
ChenYFan_OHHH
/
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,发现更多精彩内容 >>
提交
5f6838dc
编写于
2月 15, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(v3): app-confusion.js
上级
a888a512
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
12 deletion
+53
-12
packages/vue-cli-plugin-uni/lib/app-plus/index.js
packages/vue-cli-plugin-uni/lib/app-plus/index.js
+2
-2
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+18
-2
packages/vue-cli-plugin-uni/lib/split-chunks.js
packages/vue-cli-plugin-uni/lib/split-chunks.js
+26
-5
packages/webpack-uni-pages-loader/lib/platforms/app-plus/index.js
.../webpack-uni-pages-loader/lib/platforms/app-plus/index.js
+7
-3
未找到文件。
packages/vue-cli-plugin-uni/lib/app-plus/index.js
浏览文件 @
5f6838dc
...
...
@@ -73,12 +73,12 @@ const v3 = {
webpackConfig
.
optimization
.
runtimeChunk
=
{
name
:
'
app-config
'
}
webpackConfig
.
optimization
.
splitChunks
=
require
(
'
../split-chunks
'
)()
}
else
if
(
isAppView
)
{
webpackConfig
.
optimization
.
runtimeChunk
=
false
webpackConfig
.
optimization
.
splitChunks
=
false
}
webpackConfig
.
optimization
.
splitChunks
=
false
let
devtool
=
false
if
(
isAppService
&&
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
5f6838dc
...
...
@@ -14,7 +14,7 @@ if (process.env.UNI_CLOUD_SPACES) {
process
.
UNI_CLOUD
=
spaces
.
length
>
0
process
.
UNI_CLOUD_ALIYUN
=
!!
spaces
.
find
(
space
=>
space
.
clientSecret
)
if
(
spaces
.
length
===
1
)
{
const
space
=
spaces
[
0
]
const
space
=
spaces
[
0
]
console
.
log
(
`本项目的uniCloud使用的默认服务空间spaceId为:
${
space
.
id
}
`
)
if
(
space
.
clientSecret
)
{
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
({
...
...
@@ -85,7 +85,8 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
delete
process
.
env
.
UNI_USING_CACHE
}
const
{
const
{
normalizePath
,
isSupportSubPackages
,
runByHBuilderX
,
// isInHBuilderXAlpha,
...
...
@@ -194,6 +195,21 @@ if (process.env.UNI_PLATFORM === 'app-plus') {
process
.
env
.
UNI_USING_V8
=
true
process
.
env
.
UNI_OUTPUT_TMP_DIR
=
''
}
// v3 支持指定 js 混淆(仅发行模式)
if
(
process
.
env
.
NODE_ENV
===
'
production
'
&&
process
.
env
.
UNI_USING_V3
)
{
const
resources
=
platformOptions
.
confusion
&&
platformOptions
.
confusion
.
resources
const
resourcesKeys
=
resources
&&
Object
.
keys
(
resources
).
filter
(
filepath
=>
path
.
extname
(
filepath
)
===
'
.js
'
)
if
(
resourcesKeys
&&
resourcesKeys
.
length
)
{
process
.
UNI_CONFUSION
=
resourcesKeys
.
map
(
filepath
=>
normalizePath
(
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
filepath
))
)
}
}
}
else
{
// 其他平台,待确认配置方案
if
(
manifestJsonObj
[
'
app-plus
'
]
&&
...
...
packages/vue-cli-plugin-uni/lib/split-chunks.js
浏览文件 @
5f6838dc
const
path
=
require
(
'
path
'
)
module
.
exports
=
function
getSplitChunks
()
{
const
{
normalizePath
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
if
(
process
.
env
.
UNI_USING_V3
)
{
return
false
if
(
!
process
.
UNI_CONFUSION
)
{
// 无加密
return
false
}
return
{
cacheGroups
:
{
vendor
:
{
minSize
:
0
,
minChunks
:
1
,
test
:
function
(
module
)
{
if
(
!
module
.
resource
)
{
return
false
}
if
(
process
.
UNI_CONFUSION
.
includes
(
normalizePath
(
module
.
resource
)))
{
return
true
}
return
false
},
name
:
'
app-confusion
'
,
chunks
:
'
all
'
}
}
}
}
if
(
!
process
.
env
.
UNI_USING_COMPONENTS
)
{
return
{
...
...
@@ -16,10 +41,6 @@ module.exports = function getSplitChunks () {
}
}
const
{
normalizePath
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
mainPath
=
normalizePath
(
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
main.
'
))
if
(
!
process
.
env
.
UNI_OPT_SUBPACKAGES
)
{
...
...
packages/webpack-uni-pages-loader/lib/platforms/app-plus/index.js
浏览文件 @
5f6838dc
...
...
@@ -321,15 +321,19 @@ module.exports = function (pagesJson, userManifestJson) {
// 检查原生混淆选项
const
confusion
=
manifestJson
.
plus
.
confusion
if
(
confusion
&&
confusion
.
resources
)
{
const
resources
=
{}
const
resources
=
{}
const
nvuePages
=
(
appJson
.
nvue
&&
appJson
.
nvue
.
pages
)
||
{}
for
(
const
key
in
confusion
.
resources
)
{
if
(
path
.
extname
(
key
)
===
'
.js
'
)
{
// 支持 js 混淆,过滤掉
continue
}
if
(
!
/
\.
nvue$/
.
test
(
key
))
{
throw
new
Error
(
`原生混淆仅支持 nvue 页面,错误的页面路径:
${
key
}
`
)
}
else
{
resources
[
key
.
replace
(
/
\.
nvue$/
,
'
.js
'
)]
=
confusion
.
resources
[
key
]
}
if
(
!
Object
.
keys
(
appJson
.
nvue
.
p
ages
).
find
(
path
=>
{
const
subNVues
=
appJson
.
nvue
.
p
ages
[
path
].
window
.
subNVues
||
[]
if
(
!
Object
.
keys
(
nvueP
ages
).
find
(
path
=>
{
const
subNVues
=
nvueP
ages
[
path
].
window
.
subNVues
||
[]
return
path
.
replace
(
/
\.
html$/
,
'
.nvue
'
)
===
key
||
subNVues
.
find
(({
path
})
=>
path
===
key
.
replace
(
/
\.
nvue$/
,
''
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录