Skip to content

Commit 309173a

Browse files
author
ws-wangjg
committed
ci: webpack build
1 parent fee4aa4 commit 309173a

1 file changed

Lines changed: 14 additions & 40 deletions

File tree

webpack/webpack.prod.js

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
88
const glob = require('glob')
99
const { PurgeCSSPlugin } = require('purgecss-webpack-plugin')
1010

11-
// const CompressionWebpackPlugin = require('compression-webpack-plugin')
12-
// const SentryWebpackPlugin = require('@sentry/webpack-plugin')
13-
1411
const HtmlMinimizerPlugin = require('html-minimizer-webpack-plugin')
1512
const { EsbuildPlugin } = require('esbuild-loader')
1613

@@ -78,35 +75,23 @@ const prodWebpackConfig = merge(common, {
7875
maxAsyncRequests: 30,
7976
maxInitialRequests: 30,
8077
cacheGroups: {
81-
// 框架代码分离
82-
react: {
83-
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
84-
name: 'react',
85-
chunks: 'all',
86-
priority: 20,
87-
},
88-
// Ant Design分离
89-
antd: {
90-
test: /[\\/]node_modules[\\/](@ant-design|antd)[\\/]/,
91-
name: 'antd',
92-
chunks: 'all',
93-
priority: 15,
94-
},
95-
// 其他第三方库
9678
vendor: {
97-
test: /[\\/]node_modules[\\/]/,
98-
name: 'vendors',
99-
chunks: 'all',
79+
test: regVendor,
80+
name: 'vendor',
81+
minChunks: 1,
10082
priority: 10,
101-
minChunks: 2,
102-
},
103-
// 公共代码
104-
common: {
105-
name: 'common',
106-
minChunks: 2,
83+
enforce: true,
10784
chunks: 'all',
108-
priority: 5,
109-
reuseExistingChunk: true,
85+
},
86+
react: {
87+
test(module) {
88+
return module.resource && module.resource.includes('node_modules/react')
89+
},
90+
chunks: 'initial',
91+
filename: 'react.[contenthash].js',
92+
priority: 1,
93+
maxInitialRequests: 2,
94+
minChunks: 1,
11095
},
11196
},
11297
},
@@ -121,15 +106,4 @@ const prodWebpackConfig = merge(common, {
121106
},
122107
})
123108

124-
// if (useSentryMap) {
125-
// prodWebpackConfig.plugins.push(
126-
// new SentryWebpackPlugin({
127-
// release: packageJson.version,
128-
// include: path.join(__dirname, '../dist/static/js'),
129-
// configFile: '../.sentryclirc',
130-
// urlPrefix: '~/static/js',
131-
// })
132-
// )
133-
// }
134-
135109
module.exports = prodWebpackConfig

0 commit comments

Comments
 (0)