mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-13 12:28:54 +08:00
perf(seller): Element Plus 按需引入 + 移除未使用的 vue-lazyload
- plugins/element.js 不再全量注册,组件由 unplugin-vue-components 按模板自动按需解析; v-loading 指令与全局配置(zhCn/size)单独保留 - chunk-framework 344KB → 279KB(gzip,-19%);样式仍走全量 CSS 保证覆盖顺序不变 - 修复 unplugin-vue-components 与 minimatch 的版本兼容(锁定 0.27.5 + resolutions 嵌套 v9) - 移除全局注册但零使用的 vue-lazyload
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
const path = require("path");
|
||||
const configs = require("./src/config");
|
||||
const CompressionPlugin = require("compression-webpack-plugin");
|
||||
const Components = require("unplugin-vue-components/webpack").default;
|
||||
const {
|
||||
ElementPlusResolver,
|
||||
} = require("unplugin-vue-components/resolvers");
|
||||
|
||||
const resolve = (dir) => path.join(__dirname, dir);
|
||||
|
||||
@@ -54,14 +58,25 @@ module.exports = {
|
||||
},
|
||||
productionSourceMap: false,
|
||||
configureWebpack: {
|
||||
plugins: enableProduction
|
||||
? [
|
||||
new CompressionPlugin({
|
||||
test: /\.js$|\.html$|\.css/,
|
||||
threshold: 10240,
|
||||
}),
|
||||
]
|
||||
: [],
|
||||
plugins: [
|
||||
// Element Plus 组件按需引入(模板中的 el-* 自动解析为对应组件的具名导入)
|
||||
// importStyle: false —— 样式仍由 plugins/element.js 的全量 CSS 提供,避免分包后自定义样式覆盖顺序变化
|
||||
Components({
|
||||
resolvers: [ElementPlusResolver({ importStyle: false })],
|
||||
dts: false,
|
||||
// 仅用 resolver(无 dirs 目录扫描),关闭文件监听,
|
||||
// 规避 0.27.x 与被提升的 minimatch 版本不兼容导致的 dev 崩溃
|
||||
watch: false,
|
||||
}),
|
||||
...(enableProduction
|
||||
? [
|
||||
new CompressionPlugin({
|
||||
test: /\.js$|\.html$|\.css/,
|
||||
threshold: 10240,
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
],
|
||||
optimization: {
|
||||
runtimeChunk: "single",
|
||||
splitChunks: {
|
||||
|
||||
Reference in New Issue
Block a user