Commit ace5419e authored by 武广's avatar 武广

Merge branch 'feature/sourcemap' of git.quantgroup.cn:ui/merchant-manage-ui...

Merge branch 'feature/sourcemap' of git.quantgroup.cn:ui/merchant-manage-ui into feature/sourcemap-merchant
parents 1284ccdf 217b1c77
...@@ -48,7 +48,6 @@ const plugins = [ ...@@ -48,7 +48,6 @@ const plugins = [
}, },
], ],
]; ];
export default { export default {
antd: {}, antd: {},
dva: { dva: {
...@@ -62,7 +61,7 @@ export default { ...@@ -62,7 +61,7 @@ export default {
targets: { targets: {
ie: 11, 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', // devtool: 'source-map',
// uglifyJSOptions: { // uglifyJSOptions: {
// sourceMap: true // sourceMap: true
...@@ -344,7 +343,7 @@ export default { ...@@ -344,7 +343,7 @@ export default {
}, },
}, },
}, },
chunks: ['umi', 'antdesigns'], chunks: ['antdesigns', 'vendors', 'mapvgl', 'umi'],
chainWebpack: webpackPlugin, chainWebpack: webpackPlugin,
nodeModulesTransform: { nodeModulesTransform: {
type: 'none', type: 'none',
......
...@@ -70,60 +70,45 @@ export default config => { ...@@ -70,60 +70,45 @@ export default config => {
}, },
]); ]);
} // optimize chunks } // 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 config.optimization // share the same chunks across different modules
// .runtimeChunk(false)
.splitChunks({ .splitChunks({
chunks: 'async', chunks: 'all', //async异步代码分割 initial同步代码分割 all同步异步分割都开启
// 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 了。
automaticNameDelimiter: '.', automaticNameDelimiter: '.',
name: true,
minSize: 30000, // 引入的文件大于30kb才进行分割
minChunks: 1, // 模块至少使用次数
cacheGroups: { cacheGroups: {
// 分离antd系代码
antdesigns: { antdesigns: {
// antdsign
name: 'antdesigns', name: 'antdesigns',
chunks: 'all', chunks: 'all',
test: /(@antd|antd|@ant-design)/, test: /[\\/]node_modules[\\/](@antv|antd|@ant-design|rc-*|[\\@]ctrl[\\/]tinycolor|tinycolor2)/,
priority: 10, priority: 10,
enforce: true,
}, },
// 分离公共类库
vendors: { vendors: {
test: module => { name: 'vendors',
const packageName = getModulePackageName(module) || ''; chunks: 'all',
test: /([\\/]node_modules[\\/](lodash|moment|react|dva|postcss|mapbox-gl|date-fns|sentry|react-sortablejs|sortablejs))|([\\/]src[\\/]utils[\\/]qiniu\.min\.js)/,
if (packageName) { priority: 10,
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,
enforce: true, enforce: true,
}, },
// 分离geo库
mapvgl: {
name: 'mapvgl',
chunks: 'all',
test: /[\\/]node_modules[\\/](mapvgl|react-bmapgl|react-amap)/,
priority: 11,
},
}, },
}); });
}; };
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
} }
} }
.pullImage { .pullImage {
position: absolute; position: absolute !important;
top: 30px; top: 30px;
right: 40px; right: 40px;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment