Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

本地运行超级慢,不知道啥原因 #5

Open
pamxy opened this issue Dec 28, 2021 · 10 comments
Open

本地运行超级慢,不知道啥原因 #5

pamxy opened this issue Dec 28, 2021 · 10 comments

Comments

@pamxy
Copy link

pamxy commented Dec 28, 2021

本地运行超级慢,不知道啥原因/(ㄒoㄒ)/~~

@lpz1096
Copy link

lpz1096 commented Jan 29, 2022

确实有这个问题,打开页面加载很慢

@lpz1096
Copy link

lpz1096 commented Jan 29, 2022

多谢大佬的项目,学到了很多知识,从去年你发布gitee就关注你了,刚给你发了小红包买杯咖啡

@buqiyuan
Copy link
Owner

buqiyuan commented Feb 9, 2022

多谢大佬的项目,学到了很多知识,从去年你发布gitee就关注你了,刚给你发了小红包买杯咖啡

😁谢谢大兄弟支持!加载慢原因大概是像这篇文章分析的,优化的话,可能还是得像vite官方文档(依赖预构建)中所说的将有许多内部模块的 ESM 依赖关系转换为单个模块,以提高后续页面加载性能

@buqiyuan
Copy link
Owner

buqiyuan commented Feb 9, 2022

@pamxy @lpz1096 已修复,重复刷新页面是antfu大佬的unplugin-vue-components问题,已替换为vite-plugin-style-import

qingmang added a commit to qingmang/vite-vue3-admin that referenced this issue Feb 12, 2022
perf: use vite-plugin-style-import replace unplugin-vue-components buqiyuan#5
@Meihualu-cc
Copy link

可是替换为vite-plugin-style-import还是很慢哎

@buqiyuan
Copy link
Owner

buqiyuan commented Mar 31, 2022

可是替换为vite-plugin-style-import还是很慢哎

(⊙o⊙)…有多慢呢?vite的主要优势在于开发时冷启动速度快,但是在首次启动时 按需编译的过程还是需要耗费一定时间的,首次启动时页面有十几秒的等待时间很正常,你看下network 请求mian.ts的耗时多久

@Meihualu-cc
Copy link

可是替换为vite-plugin-style-import还是很慢哎

(⊙o⊙)…有多慢呢?vite的主要优势在于开发时冷启动速度快,但是在首次启动时 按需编译的过程还是需要耗费一定时间的,首次启动时页面有十几秒的等待时间很正常,你看下network 请求mian.ts的耗时多久

请求mian.ts耗时37s,我就首次启动时页面加载慢,而且不止十几秒

@buqiyuan
Copy link
Owner

buqiyuan commented Apr 1, 2022

请求mian.ts耗时37s,我就首次启动时页面加载慢,而且不止十几秒

image
(⊙o⊙)…那应该是你机器性能问题了 我本地都是在15s左右,你可以尝试启用http2 或 合理使用import()进行按需加载 看能否优化那么丢丢了

@meguoe
Copy link

meguoe commented Aug 9, 2022

可是替换为vite-plugin-style-import还是很慢哎

(⊙o⊙)…有多慢呢?vite的主要优势在于开发时冷启动速度快,但是在首次启动时 按需编译的过程还是需要耗费一定时间的,首次启动时页面有十几秒的等待时间很正常,你看下network 请求mian.ts的耗时多久

请求mian.ts耗时37s,我就首次启动时页面加载慢,而且不止十几秒

在vite.config.ts -> optimizeDeps -> include 中加入常用的组件:
'ant-design-vue/es/menu/style/css',
'ant-design-vue/es/card/style/css',

@meguoe
Copy link

meguoe commented Aug 9, 2022

在vite.config.ts -> optimizeDeps -> include 中加入常用的组件:
'ant-design-vue/es/menu/style/css',
'ant-design-vue/es/card/style/css',
把常用的组件加入到预编译后,首次运行访问就很快了

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants