From 154408fa8bb9d1c39e49038da163c2be04e5892d Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 26 Jun 2022 21:52:40 +0800 Subject: [PATCH] perf: remove less source file to remove bundle size (#10752) * perf: remove css source file to remove bundle size * docs: update migration guide --- packages/vant/docs/markdown/migrate-from-v3.zh-CN.md | 2 ++ packages/vant/vant.config.mjs | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/vant/docs/markdown/migrate-from-v3.zh-CN.md b/packages/vant/docs/markdown/migrate-from-v3.zh-CN.md index 774333f88..24e92260d 100644 --- a/packages/vant/docs/markdown/migrate-from-v3.zh-CN.md +++ b/packages/vant/docs/markdown/migrate-from-v3.zh-CN.md @@ -112,6 +112,8 @@ emit('clickInput'); 目前 Vant 已经支持了基于 CSS 变量的主题定制能力,因此后续将不再提供基于 Less 的主题定制方式。 +这意味着 Vant 的 npm 包中将不再会包含 `.less` 样式源文件,只会提供编译后的 `.css` 样式文件。 + 如果你的项目正在使用旧版的 Less 主题定制,请使用 [ConfigProvider 全局配置](#/zh-CN/config-provider) 组件进行替换。 ### 简化 CSS 变量名 diff --git a/packages/vant/vant.config.mjs b/packages/vant/vant.config.mjs index 955b34a96..60ec8c542 100644 --- a/packages/vant/vant.config.mjs +++ b/packages/vant/vant.config.mjs @@ -6,15 +6,19 @@ export default { skipInstall: ['lazyload'], packageManager: 'pnpm', extensions: { - esm: '.mjs' + esm: '.mjs', }, site: { publicPath: - (typeof window === 'undefined' && process.env.PUBLIC_PATH) || '/vant/v4', + (typeof window === 'undefined' && process.env.PUBLIC_PATH) || + '/vant/v4', }, vetur: { tagPrefix: 'van-', }, + css: { + removeSourceFile: true, + }, }, site: { defaultLang: 'en-US',