Skip to content
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

[tree shaking]使用vite开发时,浏览器过多无用请求 #3079

Open
ChengZicy opened this issue Jul 10, 2023 · 6 comments
Open

[tree shaking]使用vite开发时,浏览器过多无用请求 #3079

ChengZicy opened this issue Jul 10, 2023 · 6 comments
Labels
💪🏻 enhancement New feature or request 🏃 in progress someone is developing

Comments

@ChengZicy
Copy link

tdesign-vue-next 版本

1.3.10

重现链接

No response

重现步骤

使用按需引入或者使用auto-import引入时,都会出现这样的情况

import { Button as TButton } from 'tdesign-vue-next'
app.use(TButton)


<t-button>Click</t-button>
image image

浏览器会加载所有icon的js,以及所有组件的style,因为请求过多,导致devtools每次打开都会很卡

期望结果

按需引入只加载应加载的部分,例如引入button,就只加载button有关的css
可以提供一个开关,是否加载icon资源

实际结果

No response

框架版本

3

浏览器版本

No response

系统版本

No response

Node版本

18

补充说明

No response

@github-actions
Copy link
Contributor

👋 @ChengZicy,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@ChengZicy ChengZicy changed the title [tree shaking]使用vite开发并按需导入时,浏览器会请求过多无用数据 [tree shaking]使用vite开发并按需导入时,浏览器过多无用请求 Jul 10, 2023
@ChengZicy ChengZicy changed the title [tree shaking]使用vite开发并按需导入时,浏览器过多无用请求 [tree shaking]使用vite开发时,浏览器过多无用请求 Jul 10, 2023
@ChengZicy
Copy link
Author

补充:全局导入也是一样

@uyarn uyarn added 💪🏻 enhancement New feature or request 🙏🏻 help wanted Extra attention is needed labels Jul 11, 2023
@wangyang0210
Copy link
Contributor

wangyang0210 commented Jul 14, 2023

https://stackblitz.com/edit/yyyqnc-ytgbmc?file=src%2Fmain.js
import Button from 'tdesign-vue-next/es/button';

走index.mjs的话,的确会引入全部的组件及样式;
image

@skywalker512
Copy link

skywalker512 commented Jul 16, 2023

应该可以确定是这个提交导致 icon 被 splitting 了

Tencent/tdesign-icons#52

已经在对应仓库发起了 issue 了。

因为请求过多,导致devtools每次打开都会很卡

这个是 chrome 的 bug,已经修复合入 chrome 115 了
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4642732

@uyarn uyarn added 🏃 in progress someone is developing and removed 🙏🏻 help wanted Extra attention is needed labels Jul 17, 2023
@uyarn
Copy link
Collaborator

uyarn commented Jul 17, 2023

有两部分 一部分是图标的Chunk 一部分是其他组件的css 处理中

@uyarn
Copy link
Collaborator

uyarn commented Jul 17, 2023

icons-vue-next 升级至 0.1.12 可以解决图标chunk加载的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪🏻 enhancement New feature or request 🏃 in progress someone is developing
Projects
None yet
Development

No branches or pull requests

4 participants