-
-
Notifications
You must be signed in to change notification settings - Fork 47.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
不全局引入ant样式的话打包后发布到线上ant的样式全部丢了 #48826
Comments
使用什么脚手架?提供最小复现仓库 |
Hello @jie123js. Please provide a online reproduction by forking codesandbox of antd@5.x or antd@4.x, or provide a minimal GitHub repository. Issues labeled by 你好 @jie123js,我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 antd@5.x 或 antd@4.x 的 codesandbox,或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。 |
|
create-react-app 实际项目中是不需要这行代码的 但是打包上线不加的话样式就全丢了 测试环境是不丢的 内网环境就不行 |
|
https://gitee.com/zheng-daniu/ant-test 现在里面是import 'antd/dist/antd.css' 但是正常删了这行代码也不影响 只是打包会影响 |
antd 5.0 中都不存在 |
antd v5没有这个 css 文件,我运行时候报错了,我注释了。 |
@jie123js 请给出重现步骤吧。 |
具体的可以用这2张打包后的图给你们看看 |
请给出一步一步的重现步骤,帮助我们本地也能搭建出无法看到样式的页面。 你给的 gitee 仓库里我们是没有重现出来的。 |
我给的仓库是好的,是复现不出来的,这个问题主要我是想问为啥我不加import 'antd/dist/antd.css'这句话打包 发布到线上会有差异,有的线上样式(公司搭的测试环境)可以加载出来(不用加导入也可以加载出来),有的线上环境(甲方的内网环境)样式加载不出来必须加了这句话后才把样式打包进去(没加打包3.5M,加了打包3.7M) 问题其实是已经解决了 我是想看看有没有人遇到一样的问题 |
首先 antd v5 没有这个 css,具体你说加上能用,估计是哪个环节有 antd v4 的依赖吧?具体需要你自己排查了。可以打印 version 看下运行的 antd 版本 |
没有重现的话,我们也猜不出来什么原因。如果需要手动 import antd/dist/antd.css 样式才能生效的话,那一定是用了 antd 4 而不是 antd 5,因为 antd 5 没有这个文件。 |
Reproduction link
http://172.16.19.67:11051/
Steps to reproduce
具体就是很奇怪,本地我没有全局引入样式是没问题的,公司测试环境部署也是没问题的,但是发布到内网后ant的样式全丢了,最后我必须全局import 'antd/dist/antd.css'加了这个后样式才出来,这个url你们访问不了的 内网的
What is expected?
如果不需要全局引入,打包应该出现ant的样式
What is actually happening?
没有全局引入import 'antd/dist/antd.css',的话,打包后发布到内网环境的线上样式就没了,只是ant的样式没了,基础的CSS样式是有的,很奇怪普通的环境不用全局引入也是好的,但是内网如果不加这个就出不来
我只是就提问一下 到底需要全局引入这个样式吗,我看文档,文档好像都是按需加载都没写要import 'antd/dist/antd.css',
The text was updated successfully, but these errors were encountered: