Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
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
ReactWeb5
CivWeb
Commits
5ddf07d8
Commit
5ddf07d8
authored
Apr 25, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化生产环境打包splitChunks
parent
d462f7f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
9 deletions
+37
-9
webpack.prod.babel.js
internals/webpack/webpack.prod.babel.js
+36
-8
app.js
src/app.js
+1
-1
No files found.
internals/webpack/webpack.prod.babel.js
View file @
5ddf07d8
...
@@ -50,13 +50,16 @@ module.exports = require('./webpack.base.babel')({
...
@@ -50,13 +50,16 @@ module.exports = require('./webpack.base.babel')({
concatenateModules
:
true
,
concatenateModules
:
true
,
runtimeChunk
:
'single'
,
runtimeChunk
:
'single'
,
splitChunks
:
{
splitChunks
:
{
maxSize
:
100
*
1024
,
// 控制包的最大字节数
minSize
:
20000
,
minSize
:
10
*
1024
,
// 控制包的最小字节数
minRemainingSize
:
0
,
minChunks
:
1
,
maxAsyncRequests
:
30
,
// webpack4,5区别较大
maxInitialRequests
:
30
,
// webpack4,5区别较大
enforceSizeThreshold
:
50000
,
cacheGroups
:
{
cacheGroups
:
{
vendor
:
{
vendor
:
{
chunks
:
'all'
,
chunks
:
'all'
,
minSize
:
0
,
maxInitialRequests
:
5
,
maxInitialRequests
:
10
,
test
:
/
[\\/]
node_modules
[\\/]
/
,
test
:
/
[\\/]
node_modules
[\\/]
/
,
name
(
module
)
{
name
(
module
)
{
const
packageName
=
module
.
context
.
match
(
const
packageName
=
module
.
context
.
match
(
...
@@ -72,12 +75,37 @@ module.exports = require('./webpack.base.babel')({
...
@@ -72,12 +75,37 @@ module.exports = require('./webpack.base.babel')({
test
:
/
[\\/]
src
[\\/]
components
[\\/]
/
,
test
:
/
[\\/]
src
[\\/]
components
[\\/]
/
,
name
:
'biz-component'
,
name
:
'biz-component'
,
},
},
react
:
{
arcgis_views
:
{
chunks
:
'all'
,
chunks
:
'all'
,
minSize
:
0
,
minSize
:
0
,
maxInitialRequests
:
10
,
maxInitialRequests
:
5
,
test
:
/
[\\/]
node_modules
[\\/]
react-dom
[\\/]
/
,
priority
:
20
,
name
:
'react-dom'
,
test
:
/
[\\/]
node_modules
[\\/]
@arcgis
[\\/]
core
[\\/]
views
[\\/]
/
,
name
:
'arcgis_views'
,
},
arcgis_views_3d
:
{
chunks
:
'all'
,
minSize
:
0
,
maxInitialRequests
:
5
,
priority
:
22
,
test
:
/
[\\/]
node_modules
[\\/]
@arcgis
[\\/]
core
[\\/]
views
[\\/]
3d
[\\/]
/
,
name
:
'arcgis_views_3d'
,
},
arcgis_layers
:
{
chunks
:
'all'
,
minSize
:
0
,
maxInitialRequests
:
5
,
priority
:
10
,
test
:
/
[\\/]
node_modules
[\\/]
@arcgis
[\\/]
core
[\\/]
layers
[\\/]
/
,
name
:
'arcgis_layers'
,
},
arcgis_chunks
:
{
chunks
:
'all'
,
minSize
:
0
,
maxInitialRequests
:
5
,
priority
:
30
,
test
:
/
[\\/]
node_modules
[\\/]
@arcgis
[\\/]
core
[\\/]
chunks
[\\/]
/
,
name
:
'arcgis_chunks'
,
}
}
},
},
},
},
...
...
src/app.js
View file @
5ddf07d8
...
@@ -3,7 +3,7 @@ import './public-path';
...
@@ -3,7 +3,7 @@ import './public-path';
import
'!file-loader?name=[name].[ext]!./images/favicon.ico'
;
import
'!file-loader?name=[name].[ext]!./images/favicon.ico'
;
import
'./global.less'
;
import
'./global.less'
;
import
'animate.css/animate.css'
;
import
'animate.css/animate.css'
;
import
'antd/dist/antd.less'
;
//
import 'antd/dist/antd.less';
import
'file-loader?name=.htaccess!./.htaccess'
;
// eslint-disable-line import/extensions
import
'file-loader?name=.htaccess!./.htaccess'
;
// eslint-disable-line import/extensions
import
'@wisdom-utils/utils/lib/helpers/format'
;
import
'@wisdom-utils/utils/lib/helpers/format'
;
import
'sanitize.css/sanitize.css'
;
import
'sanitize.css/sanitize.css'
;
...
...
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