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

[CSS] CSS 样式在发布后丢失 #3385

Open
laolarou726 opened this issue Feb 26, 2025 · 3 comments
Open

[CSS] CSS 样式在发布后丢失 #3385

laolarou726 opened this issue Feb 26, 2025 · 3 comments
Labels
🐞 bug Something isn't working compatibility issue for compatibility

Comments

@laolarou726
Copy link

tdesign-react 版本

v1.11.0

重现链接

No response

重现步骤

main.tsx 添加 import "tdesign-react/es/style/index.css";

在 Dev 模式下样式显示均正常,使用 vite build 构建后发现大部分控件样式丢失。

如果使用 import "tdesign-react/dist/tdesign.css"; 能够正常发布且样式正常,但打包的 CSS 体积非常大。

vite.config.ts

import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "vite";
import { patchCssModules } from "vite-css-modules";

// https://vite.dev/config/
export default defineConfig({
    plugins: [patchCssModules(), react(), tailwindcss()]
});

期望结果

根据官方文档 import "tdesign-react/es/style/index.css"; 应该能够正常使用

实际结果

No response

框架版本

React 18.2.0

浏览器版本

133.0.3065.82

系统版本

Windows 11 24H2

Node版本

v22.14.0

补充说明

No response

Copy link
Contributor

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

@laolarou726 laolarou726 changed the title [CSS] CSS 样式再发布后丢失 [CSS] CSS 样式在发布后丢失 Feb 26, 2025
@laolarou726
Copy link
Author

经过检查发现主要是 Menu 控件的样式丢失了,其他控件的样式看起来都是正常的。
是需要引入额外的 CSS 样式吗?

@laolarou726
Copy link
Author

经过检查发现主要是 Menu 控件的样式丢失了,其他控件的样式看起来都是正常的。 是需要引入额外的 CSS 样式吗?

手动将 tdesign-react/es/style/index.css 中 menu 相关样式拷贝到项目目录中能够解决问题

@HaixingOoO HaixingOoO added 🐞 bug Something isn't working invalid This doesn't seem right compatibility issue for compatibility and removed invalid This doesn't seem right labels Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working compatibility issue for compatibility
Projects
None yet
Development

No branches or pull requests

2 participants