Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fe-app-h5
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
万亚飞
fe-app-h5
Commits
df17ed68
Commit
df17ed68
authored
May 30, 2019
by
万亚飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置优化
parent
02213f41
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
8 deletions
+42
-8
README.md
README.md
+2
-0
webpack.base.js
build/webpack.base.js
+2
-7
webpack.prod.js
build/webpack.prod.js
+38
-1
No files found.
README.md
View file @
df17ed68
#专家版 APP 内嵌 H5 页面
# React-webpack ------基于 antd-mobile 等库的一套移动端完美脚手架配置
# 包管理器使用 yarn,下载后 yarn init ,然后 yarn 即可获取所有依赖
...
...
build/webpack.base.js
View file @
df17ed68
...
...
@@ -7,9 +7,10 @@ function resolveRoot(dir) {
module
.
exports
=
{
entry
:
{
vendor
:
[
'babel-polyfill'
],
vendor
:
[
'babel-polyfill'
,
'react'
,
'react-dom'
,
'react-router-dom'
,
'antd-mobile'
,
'moment'
],
app
:
resolveRoot
(
'src/index.js'
)
},
// , 'react', 'moment', 'antd-mobile', 'react-photoswipe'
output
:
{
path
:
resolveRoot
(
'dist'
)
},
...
...
@@ -21,11 +22,5 @@ module.exports = {
'@static'
:
resolveRoot
(
'src/static'
),
'@'
:
resolveRoot
(
'src'
)
}
},
optimization
:
{
runtimeChunk
:
true
,
splitChunks
:
{
chunks
:
'all'
}
}
};
build/webpack.prod.js
View file @
df17ed68
...
...
@@ -198,5 +198,42 @@ module.exports = merge(base, {
// include: [/\.js$/, /\.css$/, /\.html$/, /\.jpg/, /\.jpeg/, /\.svg/, /\.webp/, /\.png/]
// }),
],
mode
:
'production'
mode
:
'production'
,
optimization
:
{
runtimeChunk
:
true
,
splitChunks
:
{
chunks
:
'async'
,
minSize
:
30000
,
// 形成一个新代码块最小的体积
// maxAsyncRequests: 5, // 按需加载时候最大的并行请求数
// maxInitialRequests: 3, // 最大初始化请求数
automaticNameDelimiter
:
'~'
,
// 打包分割符
name
:
true
,
cacheGroups
:
{
vendor
:
{
// 打包两个页面的公共代码
test
:
/react|react-dom|react-router-dom|babel-polyfill|antd-mobile/
,
chunks
:
'async'
,
priority
:
5
// 优先
},
moment
:
{
test
:
/moment/
,
name
:
'moment'
,
// 单独将 elementUI 拆包
priority
:
20
// 权重需大于其它缓存组
},
// 'async-commons': {
// // 异步加载公共包、组件等
// chunks: 'async',
// minChunks: 2,
// name: 'async-commons',
// priority: 10
// },
commons
:
{
// 其他同步加载公共包
chunks
:
'initial'
,
priority
:
2
,
minChunks
:
2
}
}
}
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment