Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
a4a36a8a
U
uni-app
项目概览
DCloud
/
uni-app
4 个月 前同步成功
通知
730
Star
38707
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看板
提交
a4a36a8a
编写于
4月 27, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(plugin): add configurePages
上级
04833949
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
10 deletion
+19
-10
packages/uni-cli-shared/lib/plugin.js
packages/uni-cli-shared/lib/plugin.js
+1
-0
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
+1
-1
packages/vue-cli-plugin-uni/packages/webpack-html-append-plugin/index.js
...i-plugin-uni/packages/webpack-html-append-plugin/index.js
+10
-6
packages/webpack-uni-pages-loader/lib/index-new.js
packages/webpack-uni-pages-loader/lib/index-new.js
+1
-1
packages/webpack-uni-pages-loader/lib/platforms/h5.js
packages/webpack-uni-pages-loader/lib/platforms/h5.js
+6
-2
未找到文件。
packages/uni-cli-shared/lib/plugin.js
浏览文件 @
a4a36a8a
...
...
@@ -9,6 +9,7 @@ const Plugin = {
configureEnv
:
[],
// (){},
// 以 H5 为基准的平台特殊配置
configureH5
:
[],
// (h5Options) {},
configurePages
:
[],
// (pagesJson,manifestJson,loader) {},
// 链式修改 webpack config
chainWebpack
:
[],
// (config, vueOptions, api) {},
// 修改 webpack config
...
...
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
浏览文件 @
a4a36a8a
...
...
@@ -54,7 +54,7 @@ function getAssetsCopyOptions (assetsDir) {
function
getCopyWebpackPluginOptions
(
platformOptions
,
vueOptions
)
{
const
copyOptions
=
getAssetsCopyOptions
(
assetsDir
)
global
.
uniPlugin
.
copyWebpackOptions
.
forEach
(
copyWebpackOptions
=>
{
const
platformCopyOptions
=
copyWebpackOptions
(
platformOptions
,
vueOptions
)
||
[]
const
platformCopyOptions
=
copyWebpackOptions
(
platformOptions
,
vueOptions
,
copyOptions
)
||
[]
platformCopyOptions
.
forEach
(
copyOption
=>
{
if
(
typeof
copyOption
===
'
string
'
)
{
copyOption
=
getAssetsCopyOption
(
copyOption
)
...
...
packages/vue-cli-plugin-uni/packages/webpack-html-append-plugin/index.js
浏览文件 @
a4a36a8a
const
HtmlWebpackPlugin
=
require
(
'
html-webpack-plugin
'
)
class
WebpackHtmlAppendPlugin
{
constructor
(
content
)
{
constructor
(
content
)
{
this
.
content
=
content
||
''
}
apply
(
compiler
)
{
apply
(
compiler
)
{
compiler
.
hooks
.
compilation
.
tap
(
'
WebpackHtmlAppendPlugin
'
,
(
compilation
)
=>
{
const
beforeEmit
=
compilation
.
hooks
.
htmlWebpackPluginAfterHtmlProcessing
||
HtmlWebpackPlugin
.
getHooks
(
compilation
).
beforeEmit
beforeEmit
.
tapAsync
(
'
WebpackHtmlAppendPlugin
'
,
(
data
,
cb
)
=>
{
let
beforeEmit
=
compilation
.
hooks
.
htmlWebpackPluginAfterHtmlProcessing
if
(
!
beforeEmit
&&
HtmlWebpackPlugin
.
getHooks
)
{
const
hooks
=
HtmlWebpackPlugin
.
getHooks
(
compilation
)
if
(
hooks
)
{
beforeEmit
=
hooks
.
beforeEmit
}
}
beforeEmit
&&
beforeEmit
.
tapAsync
(
'
WebpackHtmlAppendPlugin
'
,
(
data
,
cb
)
=>
{
data
.
html
+=
this
.
content
cb
(
null
,
data
)
})
...
...
packages/webpack-uni-pages-loader/lib/index-new.js
浏览文件 @
a4a36a8a
...
...
@@ -67,7 +67,7 @@ module.exports = function (content) {
}
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
return
require
(
'
./platforms/h5
'
)(
pagesJson
,
manifestJson
)
return
require
(
'
./platforms/h5
'
)(
pagesJson
,
manifestJson
,
this
)
}
if
(
process
.
env
.
UNI_PLATFORM
===
'
quickapp-vue
'
)
{
return
require
(
'
./platforms/quickapp-vue
'
)(
pagesJson
,
manifestJson
,
this
)
...
...
packages/webpack-uni-pages-loader/lib/platforms/h5.js
浏览文件 @
a4a36a8a
...
...
@@ -327,9 +327,13 @@ meta:{
]
}
module
.
exports
=
function
(
pagesJson
,
manifestJson
)
{
module
.
exports
=
function
(
pagesJson
,
manifestJson
,
loader
)
{
const
inputDir
=
process
.
env
.
UNI_INPUT_DIR
global
.
uniPlugin
.
configurePages
.
forEach
(
configurePages
=>
{
configurePages
(
pagesJson
,
manifestJson
,
loader
)
})
const
pageComponents
=
getPageComponents
(
inputDir
,
pagesJson
)
pagesJson
.
globalStyle
=
process
.
UNI_H5_PAGES_JSON
.
globalStyle
...
...
@@ -367,4 +371,4 @@ global.__uniConfig.nvue = ${JSON.stringify({ 'flex-direction': getFlexDirection(
${
genRegisterPageVueComponentsCode
(
pageComponents
)}
global.__uniRoutes=[
${
genPageRoutes
(
pageComponents
).
concat
(
genSystemRoutes
()).
join
(
'
,
'
)}
]
`
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录