-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Multi-level lazy loading routing will lead to multiple loading of styles and reloading of pages. #235
Comments
我也出现了这个问题,我的路由也是异步加载的配置,由于我的routes也是动态获取再进行注册的,所以我用了 vite 提供的 import.meta.glob 导入了所有路由页面然后再做匹配,比你更糟糕的是我会出现页面的无限重载,甚至vite开启的服务抛出了408的错误,我不知道如何解决这个问题,现在已经导致我无法正常开发了,只能弃用这个插件 |
@antfu 能提供下解决办法吗? |
Force packages pre-bundle |
Can you tell me exactly how to do it,thanks |
Just add packages that cause Vite reload into include list. |
Can you provide a repo with the code required to reproduce this issue? |
Please clon my repositories, I have all the latest version of the latest version: steps: |
It does solve the problem! However, its drawback is quite obvious: it requires enumerating a lot of content. |
problem description:
When I entered a new routing page (using a lazy loading situation, the following way to write):

Will load all the style files that use the components under the current routing page, resulting in Vite Reload, such as:

In my actual project, there may be some design unreasonable, there are too many routing levels, which will cause the Vite will reload multiple times when I entered the new page, introduced all the styles to enter the page, which affects the development experience.
I don't know if it was designed that way, but it does affect the development experience a little bit, and it feels like it slows down development with Vite
solution
I introduced the style directly in the development environment, and then introduced as needed when packaged:
main.js
:vite.config.ts
:I am thinking about implementing such functions inside the plugin and configured by options?
Rely version
The text was updated successfully, but these errors were encountered: