Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
217b1c77
Commit
217b1c77
authored
Jul 06, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改打包问题
parent
f1e04f6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
44 deletions
+28
-44
config.js
config/config.js
+2
-3
plugin.config.js
config/plugin.config.js
+26
-41
No files found.
config/config.js
View file @
217b1c77
...
...
@@ -48,7 +48,6 @@ const plugins = [
},
],
];
export
default
{
antd
:
{},
dva
:
{
...
...
@@ -62,7 +61,7 @@ export default {
targets
:
{
ie
:
11
,
},
devtool
:
process
.
env
.
SENTRY_ENV
===
'
test
'
?
false
:
'
hidden-source-map
'
,
// devtool: process.env.SENTRY_ENV === 'prod' ? 'hidden-source-map' : false
,
// devtool: 'source-map',
// uglifyJSOptions: {
// sourceMap: true
...
...
@@ -344,7 +343,7 @@ export default {
},
},
},
chunks
:
[
'
umi
'
,
'
antdesigns
'
],
chunks
:
[
'
antdesigns
'
,
'
vendors
'
,
'
mapvgl
'
,
'
umi
'
],
chainWebpack
:
webpackPlugin
,
nodeModulesTransform
:
{
type
:
'
none
'
,
...
...
config/plugin.config.js
View file @
217b1c77
...
...
@@ -70,60 +70,45 @@ export default config => {
},
]);
}
// optimize chunks
if
(
process
.
env
.
SENTRY_ENV
===
'
prod
'
)
{
config
.
plugin
(
'
source-map-dev-tool-plugin
'
).
use
(
webpack
.
SourceMapDevToolPlugin
,
[
{
exclude
:
/
(
antdesigns|vendors|mapvgl
)
.*/
,
// 以下文件排除不生成
filename
:
'
[file].map[query]
'
,
// 指定map文件名称
},
]);
}
config
.
optimization
// share the same chunks across different modules
// .runtimeChunk(false)
.
splitChunks
({
chunks
:
'
async
'
,
// maxInitialRequests: Infinity,
name
:
true
,
// chunk 的名称,如果设置为固定的字符串那么所有的 chunk 都会被合并成一个,这就是为什么 umi 默认只有一个 vendors.async.js。
minSize
:
30000
,
// byte, == 30 kb,越大那么单个文件越大,chunk 数就会变少(针对于提取公共 chunk 的时候,不管再大也不会把动态加载的模块合并到初始化模块中)当这个值很大的时候就不会做公共部分的抽取了
maxSize
:
0
,
// 文件的最大尺寸,优先级:maxInitialRequest/maxAsyncRequests < maxSize < minSize,需要注意的是这个如果配置了,umi.js 就可能被拆开,最后构建出来的 chunkMap 中可能就找不到 umi.js 了。
minChunks
:
3
,
// 被提取的一个模块至少需要在几个 chunk 中被引用,这个值越大,抽取出来的文件就越小
maxAsyncRequests
:
10
,
// 在做一次按需加载的时候最多有多少个异步请求,为 1 的时候就不会抽取公共 chunk 了
maxInitialRequests
:
Infinity
,
//5, // 针对一个 entry 做初始化模块分隔的时候的最大文件数,优先级高于 cacheGroup,所以为 1 的时候就不会抽取 initial common 了。
chunks
:
'
all
'
,
//async异步代码分割 initial同步代码分割 all同步异步分割都开启
automaticNameDelimiter
:
'
.
'
,
name
:
true
,
minSize
:
30000
,
// 引入的文件大于30kb才进行分割
minChunks
:
1
,
// 模块至少使用次数
cacheGroups
:
{
// 分离antd系代码
antdesigns
:
{
// antdsign
name
:
'
antdesigns
'
,
chunks
:
'
all
'
,
test
:
/
(
@antd|antd|@ant-design
)
/
,
test
:
/
[\\/]
node_modules
[\\/](
@antv|antd|@ant-design|rc-*|
[\\
@
]
ctrl
[\\/]
tinycolor|tinycolor2
)
/
,
priority
:
10
,
enforce
:
true
,
},
// 分离公共类库
vendors
:
{
test
:
module
=>
{
const
packageName
=
getModulePackageName
(
module
)
||
''
;
if
(
packageName
)
{
return
[
'
bizcharts
'
,
'
gg-editor
'
,
'
g6
'
,
'
@antv
'
,
'
gg-editor-core
'
,
'
bizcharts-plugin-slider
'
,
].
includes
(
packageName
);
}
return
false
;
},
name
(
module
)
{
const
packageName
=
getModulePackageName
(
module
);
if
(
packageName
)
{
if
([
'
bizcharts
'
,
'
@antv_data-set
'
].
indexOf
(
packageName
)
>=
0
)
{
return
'
viz
'
;
// visualization package
}
}
return
'
misc
'
;
},
priority
:
-
11
,
name
:
'
vendors
'
,
chunks
:
'
all
'
,
test
:
/
([\\/]
node_modules
[\\/](
lodash|moment|react|dva|postcss|mapbox-gl|date-fns|sentry|react-sortablejs|sortablejs
))
|
([\\/]
src
[\\/]
utils
[\\/]
qiniu
\.
min
\.
js
)
/
,
priority
:
10
,
enforce
:
true
,
},
// 分离geo库
mapvgl
:
{
name
:
'
mapvgl
'
,
chunks
:
'
all
'
,
test
:
/
[\\/]
node_modules
[\\/](
mapvgl|react-bmapgl|react-amap
)
/
,
priority
:
11
,
},
},
});
};
...
...
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