-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vite+ant-design-vue 开启css module 后加载组件库less文件初次加载时间会很慢 #3673
Comments
盲猜是因为antd的less文件太大了,解析不要时间的么? 同理,webpack也有同样的问题,毕竟要处理less。 同样,element-plus也是,要处理scss啊... 不过今天又试了vite+el plus,还换了主题色(自定义主题色之后解析/编译时间更长),感觉比以前快多了。。。 |
但是这个第一次解析花的时间太多~ |
这个 vite 没办法的,因为你直接加载 less 源码,时间是消耗在 less 的编译上,并不是 vite 能改善的问题。 |
thank u |
如果你只是需要变量的话,可以在项目的 less 中只引入 这样应该能提不少速度。 |
This issue has been locked since it has been closed for more than 14 days. If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion. |
Describe the bug
利用vite搭建vue3+ant-design-vue项目,使用css modules时引用antdv组件的less文件时初次启动加载很慢
Reproduction
vite.config.ts中的CSS配置为
引用ant-design-vue的less文件
在index.module.less中引用
之后在BasicLayout.tsx中引用
import styles from './index.module.less';
项目启动后浏览器第一次加载情况
可以看到,初次启动无缓存时
index.module.less的加载时间为 45.11S
而且有vite缓存时,偶尔加载index.module.less也会变慢
具体啥原因实在没排查出来,麻烦指教下。谢谢
System Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:Used package manager:
yarn
Logs
/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run dev --scripts-prepend-node-path=auto
Pre-bundling dependencies:
vue
ant-design-vue
vue-router
@vueuse/core
(this will be run only when your dependencies or config have changed)
vite v2.3.4 dev server running at:
ready in 1173ms.
[@vue/compiler-sfc] <script setup> is still an experimental proposal.
Follow its status at vuejs/rfcs#227.
[@vue/compiler-sfc] When using experimental features,
it is recommended to pin your vue dependencies to exact versions to avoid breakage.
Before submitting the issue, please make sure you do the following
The text was updated successfully, but these errors were encountered: