change webpack config to reduce size
This commit is contained in:
parent
c34fe87444
commit
eabd43ce88
@ -121,6 +121,6 @@
|
|||||||
"ts-loader": "8.2.0",
|
"ts-loader": "8.2.0",
|
||||||
"typescript": "^4.6.4",
|
"typescript": "^4.6.4",
|
||||||
"vue-template-compiler": "2.x",
|
"vue-template-compiler": "2.x",
|
||||||
"webpack-bundle-analyzer": "^4.5.0"
|
"webpack-bundle-analyzer": "^4.7.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ const path = require('path')
|
|||||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
||||||
// const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
// const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||||
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
|
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
|
||||||
|
|
||||||
// const productionGzipExtensions = ['js', 'css']
|
// const productionGzipExtensions = ['js', 'css']
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -19,6 +18,28 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
|
optimization: {
|
||||||
|
runtimeChunk: 'single',
|
||||||
|
splitChunks: {
|
||||||
|
chunks: 'all',
|
||||||
|
maxInitialRequests: Infinity,
|
||||||
|
minSize: 120000,
|
||||||
|
maxSize: 250000,
|
||||||
|
cacheGroups: {
|
||||||
|
vendor: {
|
||||||
|
test: /node_modules/,
|
||||||
|
name() {
|
||||||
|
// get the name. E.g. node_modules/packageName/not/this/part.js
|
||||||
|
// or node_modules/packageName
|
||||||
|
// const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)
|
||||||
|
|
||||||
|
// npm package names are URL-safe, but some servers don't like @ symbols
|
||||||
|
return 'ping.pub.chunks'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@themeConfig': path.resolve(__dirname, 'themeConfig.js'),
|
'@themeConfig': path.resolve(__dirname, 'themeConfig.js'),
|
||||||
|
23
yarn.lock
23
yarn.lock
@ -4126,9 +4126,9 @@ caniuse-api@^3.0.0:
|
|||||||
lodash.uniq "^4.5.0"
|
lodash.uniq "^4.5.0"
|
||||||
|
|
||||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001335:
|
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001335:
|
||||||
version "1.0.30001341"
|
version "1.0.30001427"
|
||||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz#59590c8ffa8b5939cf4161f00827b8873ad72498"
|
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001427.tgz"
|
||||||
integrity sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA==
|
integrity sha512-lfXQ73oB9c8DP5Suxaszm+Ta2sr/4tf8+381GkIm1MLj/YdLf+rEDyDSRCzeltuyTVGm+/s18gdZ0q+Wmp8VsQ==
|
||||||
|
|
||||||
case-sensitive-paths-webpack-plugin@^2.3.0:
|
case-sensitive-paths-webpack-plugin@^2.3.0:
|
||||||
version "2.4.0"
|
version "2.4.0"
|
||||||
@ -10106,7 +10106,7 @@ webidl-conversions@^4.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
|
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
|
||||||
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==
|
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==
|
||||||
|
|
||||||
webpack-bundle-analyzer@^4.4.0, webpack-bundle-analyzer@^4.5.0:
|
webpack-bundle-analyzer@^4.4.0:
|
||||||
version "4.5.0"
|
version "4.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.5.0.tgz#1b0eea2947e73528754a6f9af3e91b2b6e0f79d5"
|
resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.5.0.tgz#1b0eea2947e73528754a6f9af3e91b2b6e0f79d5"
|
||||||
integrity sha512-GUMZlM3SKwS8Z+CKeIFx7CVoHn3dXFcUAjT/dcZQQmfSZGvitPfMob2ipjai7ovFFqPvTqkEZ/leL4O0YOdAYQ==
|
integrity sha512-GUMZlM3SKwS8Z+CKeIFx7CVoHn3dXFcUAjT/dcZQQmfSZGvitPfMob2ipjai7ovFFqPvTqkEZ/leL4O0YOdAYQ==
|
||||||
@ -10121,6 +10121,21 @@ webpack-bundle-analyzer@^4.4.0, webpack-bundle-analyzer@^4.5.0:
|
|||||||
sirv "^1.0.7"
|
sirv "^1.0.7"
|
||||||
ws "^7.3.1"
|
ws "^7.3.1"
|
||||||
|
|
||||||
|
webpack-bundle-analyzer@^4.7.0:
|
||||||
|
version "4.7.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.7.0.tgz#33c1c485a7fcae8627c547b5c3328b46de733c66"
|
||||||
|
integrity sha512-j9b8ynpJS4K+zfO5GGwsAcQX4ZHpWV+yRiHDiL+bE0XHJ8NiPYLTNVQdlFYWxtpg9lfAQNlwJg16J9AJtFSXRg==
|
||||||
|
dependencies:
|
||||||
|
acorn "^8.0.4"
|
||||||
|
acorn-walk "^8.0.0"
|
||||||
|
chalk "^4.1.0"
|
||||||
|
commander "^7.2.0"
|
||||||
|
gzip-size "^6.0.0"
|
||||||
|
lodash "^4.17.20"
|
||||||
|
opener "^1.5.2"
|
||||||
|
sirv "^1.0.7"
|
||||||
|
ws "^7.3.1"
|
||||||
|
|
||||||
webpack-chain@^6.0.0, webpack-chain@^6.5.1:
|
webpack-chain@^6.0.0, webpack-chain@^6.5.1:
|
||||||
version "6.5.1"
|
version "6.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/webpack-chain/-/webpack-chain-6.5.1.tgz#4f27284cbbb637e3c8fbdef43eef588d4d861206"
|
resolved "https://registry.yarnpkg.com/webpack-chain/-/webpack-chain-6.5.1.tgz#4f27284cbbb637e3c8fbdef43eef588d4d861206"
|
||||||
|
Loading…
Reference in New Issue
Block a user