Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
5f6838dc
U
uni-app
项目概览
DCloud
/
uni-app
4 个月 前同步成功
通知
726
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
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 = {
...
@@ -73,12 +73,12 @@ const v3 = {
webpackConfig
.
optimization
.
runtimeChunk
=
{
webpackConfig
.
optimization
.
runtimeChunk
=
{
name
:
'
app-config
'
name
:
'
app-config
'
}
}
webpackConfig
.
optimization
.
splitChunks
=
require
(
'
../split-chunks
'
)()
}
else
if
(
isAppView
)
{
}
else
if
(
isAppView
)
{
webpackConfig
.
optimization
.
runtimeChunk
=
false
webpackConfig
.
optimization
.
runtimeChunk
=
false
webpackConfig
.
optimization
.
splitChunks
=
false
}
}
webpackConfig
.
optimization
.
splitChunks
=
false
let
devtool
=
false
let
devtool
=
false
if
(
isAppService
&&
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
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) {
...
@@ -14,7 +14,7 @@ if (process.env.UNI_CLOUD_SPACES) {
process
.
UNI_CLOUD
=
spaces
.
length
>
0
process
.
UNI_CLOUD
=
spaces
.
length
>
0
process
.
UNI_CLOUD_ALIYUN
=
!!
spaces
.
find
(
space
=>
space
.
clientSecret
)
process
.
UNI_CLOUD_ALIYUN
=
!!
spaces
.
find
(
space
=>
space
.
clientSecret
)
if
(
spaces
.
length
===
1
)
{
if
(
spaces
.
length
===
1
)
{
const
space
=
spaces
[
0
]
const
space
=
spaces
[
0
]
console
.
log
(
`本项目的uniCloud使用的默认服务空间spaceId为:
${
space
.
id
}
`
)
console
.
log
(
`本项目的uniCloud使用的默认服务空间spaceId为:
${
space
.
id
}
`
)
if
(
space
.
clientSecret
)
{
if
(
space
.
clientSecret
)
{
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
({
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
({
...
@@ -85,7 +85,8 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
...
@@ -85,7 +85,8 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
delete
process
.
env
.
UNI_USING_CACHE
delete
process
.
env
.
UNI_USING_CACHE
}
}
const
{
const
{
normalizePath
,
isSupportSubPackages
,
isSupportSubPackages
,
runByHBuilderX
,
runByHBuilderX
,
// isInHBuilderXAlpha,
// isInHBuilderXAlpha,
...
@@ -194,6 +195,21 @@ if (process.env.UNI_PLATFORM === 'app-plus') {
...
@@ -194,6 +195,21 @@ if (process.env.UNI_PLATFORM === 'app-plus') {
process
.
env
.
UNI_USING_V8
=
true
process
.
env
.
UNI_USING_V8
=
true
process
.
env
.
UNI_OUTPUT_TMP_DIR
=
''
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
{
// 其他平台,待确认配置方案
}
else
{
// 其他平台,待确认配置方案
if
(
if
(
manifestJsonObj
[
'
app-plus
'
]
&&
manifestJsonObj
[
'
app-plus
'
]
&&
...
...
packages/vue-cli-plugin-uni/lib/split-chunks.js
浏览文件 @
5f6838dc
const
path
=
require
(
'
path
'
)
const
path
=
require
(
'
path
'
)
module
.
exports
=
function
getSplitChunks
()
{
module
.
exports
=
function
getSplitChunks
()
{
const
{
normalizePath
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
if
(
process
.
env
.
UNI_USING_V3
)
{
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
)
{
if
(
!
process
.
env
.
UNI_USING_COMPONENTS
)
{
return
{
return
{
...
@@ -16,10 +41,6 @@ module.exports = function getSplitChunks () {
...
@@ -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.
'
))
const
mainPath
=
normalizePath
(
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
main.
'
))
if
(
!
process
.
env
.
UNI_OPT_SUBPACKAGES
)
{
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) {
...
@@ -321,15 +321,19 @@ module.exports = function (pagesJson, userManifestJson) {
// 检查原生混淆选项
// 检查原生混淆选项
const
confusion
=
manifestJson
.
plus
.
confusion
const
confusion
=
manifestJson
.
plus
.
confusion
if
(
confusion
&&
confusion
.
resources
)
{
if
(
confusion
&&
confusion
.
resources
)
{
const
resources
=
{}
const
resources
=
{}
const
nvuePages
=
(
appJson
.
nvue
&&
appJson
.
nvue
.
pages
)
||
{}
for
(
const
key
in
confusion
.
resources
)
{
for
(
const
key
in
confusion
.
resources
)
{
if
(
path
.
extname
(
key
)
===
'
.js
'
)
{
// 支持 js 混淆,过滤掉
continue
}
if
(
!
/
\.
nvue$/
.
test
(
key
))
{
if
(
!
/
\.
nvue$/
.
test
(
key
))
{
throw
new
Error
(
`原生混淆仅支持 nvue 页面,错误的页面路径:
${
key
}
`
)
throw
new
Error
(
`原生混淆仅支持 nvue 页面,错误的页面路径:
${
key
}
`
)
}
else
{
}
else
{
resources
[
key
.
replace
(
/
\.
nvue$/
,
'
.js
'
)]
=
confusion
.
resources
[
key
]
resources
[
key
.
replace
(
/
\.
nvue$/
,
'
.js
'
)]
=
confusion
.
resources
[
key
]
}
}
if
(
!
Object
.
keys
(
appJson
.
nvue
.
p
ages
).
find
(
path
=>
{
if
(
!
Object
.
keys
(
nvueP
ages
).
find
(
path
=>
{
const
subNVues
=
appJson
.
nvue
.
p
ages
[
path
].
window
.
subNVues
||
[]
const
subNVues
=
nvueP
ages
[
path
].
window
.
subNVues
||
[]
return
path
.
replace
(
/
\.
html$/
,
'
.nvue
'
)
===
key
||
subNVues
.
find
(({
return
path
.
replace
(
/
\.
html$/
,
'
.nvue
'
)
===
key
||
subNVues
.
find
(({
path
path
})
=>
path
===
key
.
replace
(
/
\.
nvue$/
,
''
))
})
=>
path
===
key
.
replace
(
/
\.
nvue$/
,
''
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录