From 7abdd94a0ecf7ae40037c08d3a6b405b606b6244 Mon Sep 17 00:00:00 2001 From: zuiidea Date: Tue, 7 Jan 2020 16:02:33 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20=20Optimize=20deployment=20confi?= =?UTF-8?q?guration.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .umirc.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.umirc.js b/.umirc.js index 999104d..34df45c 100644 --- a/.umirc.js +++ b/.umirc.js @@ -3,6 +3,8 @@ import { resolve } from 'path' import { i18n } from './src/utils/config' export default { + publicPath: 'https://cdn.antd-admin.zuiidea.com/', + hash: true, ignoreMomentLocale: true, targets: { ie: 9 }, treeShaking: true, @@ -99,4 +101,58 @@ export default { 'lodash', ], ], + chainWebpack: function(config, { webpack }) { + config.merge({ + optimization: { + minimize: true, + splitChunks: { + chunks: 'all', + minSize: 30000, + minChunks: 3, + automaticNameDelimiter: '.', + cacheGroups: { + react: { + name: 'react', + priority: 20, + test: /[\\/]node_modules[\\/](react|react-dom|react-dom-router)[\\/]/, + }, + antd: { + name: 'antd', + priority: 20, + test: /[\\/]node_modules[\\/](antd|@ant-design\/icons|@ant-design\/compatible|ant-design-pro)[\\/]/, + }, + echarts: { + name: 'echarts', + priority: 20, + test: /[\\/]node_modules[\\/]echarts|echarts-for-react|echarts-gl|echarts-liquidfill[\\/]/, + }, + highcharts: { + name: 'highcharts', + priority: 20, + test: /[\\/]node_modules[\\/](highcharts-exporting|highcharts-more|react-highcharts)[\\/]/, + }, + recharts: { + name: 'recharts', + priority: 20, + test: /[\\/]node_modules[\\/](recharts)[\\/]/, + }, + draftjs: { + name: 'draftjs', + priority: 20, + test: /[\\/]node_modules[\\/](draftjs-to-html|draftjs-to-markdown)[\\/]/, + }, + async: { + chunks: 'async', + minChunks: 2, + name: 'async', + maxInitialRequests: 1, + minSize: 0, + priority: 5, + reuseExistingChunk: true, + }, + }, + }, + }, + }) + }, }