当前位置:网站首页>UMI packaging and subcontracting, and compressing to gzip
UMI packaging and subcontracting, and compressing to gzip
2022-06-12 08:42:00 【__ Xiao Yu】
umi Packing and subcontracting 、 Compress it into gzip
1、 Compression plug-ins 【 Note that version 】
"compression-webpack-plugin": "^6.0.0",
2、 stay .umirc.ts (config.js、config.ts) File to add
chunks: ['vendors', 'umi'],
chainWebpack: function (config, {
webpack }) {
config.merge({
optimization: {
splitChunks: {
chunks: 'all',
minSize: 30000,
minChunks: 3,
automaticNameDelimiter: '.',
cacheGroups: {
react: {
name: 'react',
priority: 20,
test: /[\\/]node_modules[\\/](react|react-dom|react-dom-router)[\\/]/,
},
vendor: {
name: 'vendors',
test({
resource }) {
return /[\\/]node_modules[\\/]/.test(resource);
},
priority: 6,
},
antd: {
name: "antd",
test: /[\\/]node_modules[\\/]antd[\\/]/,
chunks: "all",
priority: 10
},
xlsx: {
name: "xlsx",
test: /[\\/]node_modules[\\/]xlsx[\\/]/,
chunks: "async",
priority: 10
},
reactcolor: {
name: "xlsx",
test: /[\\/]node_modules[\\/]react-color[\\/]/,
chunks: "async",
priority: 19
},
wangeditor: {
name: 'wangeditor',
priority: 21,
test: /[\\/]node_modules[\\/](wangeditor|@wangeditor|@wangeditor\/editor|@wangeditor\/editor-for-react)[\\/]/,
},
uiwmap: {
name: 'uiwmap',
priority: 20,
test: /[\\/]node_modules[\\/](uiw|@uiw|@uiw\/react-baidu-map|@uiw\/react-baidu-map-require-script)[\\/]/,
},
charts: {
name: 'charts',
priority: 20,
test: /[\\/]node_modules[\\/](@ant-design\/charts)[\\/]/,
},
async: {
chunks: 'async',
minChunks: 2,
name: 'async',
maxInitialRequests: 1,
minSize: 0,
priority: 5,
reuseExistingChunk: true,
},
},
},
}
});
if (process.env.NODE_ENV === 'production') {
//gzip Compress
config.plugin('compression-webpack-plugin').use(CompressionPlugin, [
{
test: /\.js$|\.html$|\.css$/, // Match file name
threshold: 10240, // For more than 10k Data compression
deleteOriginalAssets: false, // Don't delete the source file
},
]);
}
// To filter out momnet Those unused internationalization files
config.plugin("replace").use(require("webpack").ContextReplacementPlugin).tap(() => {
return [/moment[/\\]locale$/, /zh-cn/];
});
}
3、nginx To configure
# On and off gzip Pattern
gzip on;
# gizp Compress the starting point , File is larger than 1k To compress
gzip_min_length 1k;
# gzip Compression level ,1-9, The bigger the number, the better the compression , More and more occupied CPU Time
gzip_comp_level 6;
# The type of file to be compressed .
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/xml text/javascript application/json;
# /**** At present, only one additional line is effective **/
# nginx For static file processing module , When it is turned on, it will look for .gz Final document , Go straight back to , Will not occupy cpu Compress
gzip_static on;
# Whether in http header Add Vary: Accept-Encoding, Recommended Opening
gzip_vary on;
# Set the buffer size required for compression , With 4k In units of , If the document is 7k Then apply for 2*4k The buffer
gzip_buffers 4 16k;
边栏推荐
- In depth interpretation of 5g key technologies
- What is the MES system? What is the operation process of MES system?
- Installation of Shengxin R package
- Background position position NOUN
- The Three Kingdoms kill the surrounding areas -------- explanation of the pig Kingdom kill problem
- Detailed explanation of private, public and interface attributes in cmake
- Gets the number of occurrences of a character in a string
- Is it really expensive for enterprises to launch MES software?
- Install iptables services and open ports
- 动态线段树leetcode.699
猜你喜欢

MSTP的配置与原理

Where does the driving force of MES system come from? What problems should be paid attention to in model selection?

Loading circling effect during loading

JVM学习笔记:垃圾回收机制

JVM learning notes: garbage collection mechanism

In the era of intelligent manufacturing, how do enterprises carry out digital transformation

安科瑞消防应急照明和疏散指示系统

Hypergeometric cumulative distribution test overlap

Centos8 installing MySQL 8.0 (upper)

(p19-p20) delegate constructor (proxy constructor) and inheritance constructor (using)
随机推荐
Background position - mixed units
Get last month, current time and next month
FDA reviewers say Moderna covid vaccine is safe and effective for children under 5 years of age
2022.6.11-----leetcode.926
What is the beauty of MES equipment management for enterprises?
Wechat applet image saving function
Jump to an interface at a specified time. (Web Development)
What is the difference between ERP production management and MES management system?
JVM学习笔记:三 本地方法接口、执行引擎
The residual pressure monitoring system ensures the smoothness of the fire evacuation passage in case of fire, and protects the safe operation of large high-rise buildings and the safety of people's l
Arrays in JS
[data storage] storage of floating point data in memory
Background location case 1
What scheduling rules does the APS software have? What is the exception handling scheme?
Installation series of ROS system (I): installation steps
Hands on deep learning 18 -- model selection + over fitting and under fitting and code implementation
Vscode download slow solution
MES helps enterprises to transform intelligently and improve the transparency of enterprise production
Code generation tool Autocode for XML Publishing
Difference between binary GB and gib