Commit f4d255e2 authored by 邓超's avatar 邓超

fix: webpack打包速度优化

parent 64d50bfb
Pipeline #69756 waiting for manual action with stages
This diff is collapsed.
// Important modules this config uses
const os = require('os');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
......@@ -7,6 +8,8 @@ const WebpackPwaManifest = require('webpack-pwa-manifest');
const TerserPlugin = require('terser-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
// cpu核数
const threads = os.cpus().length;
module.exports = require('./webpack.base.babel')({
mode: 'production',
......@@ -39,7 +42,7 @@ module.exports = require('./webpack.base.babel')({
ascii_only: true,
},
},
parallel: true,
parallel: threads, // 开启多进程
cache: true,
sourceMap: true,
}),
......
......@@ -265,6 +265,7 @@
"stylelint-processor-styled-components": "1.6.0",
"svg-url-loader": "2.3.2",
"terser-webpack-plugin": "4.2.3",
"thread-loader": "^3.0.4",
"url-loader": "1.1.2",
"webpack": "5.70.0",
"webpack-cli": "4.2.0",
......
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