Vite 2.x 下如何使用 antd ? #29660
Replies: 4 comments 5 replies
-
问题已解决,配置已更新。 |
Beta Was this translation helpful? Give feedback.
-
今天又发现了一个问题,当在 Vite 下混用 antd/es 和 antd/lib 时,编译会有问题。原因是 @babel/runtime 在 antd/lib 和其内部使用方式不同: 在 antd/lib/locale-provider/index.js 中: var _typeof = require("@babel/runtime/helpers/typeof"); 在 @babel/runtime/helpers/interopRequireWildcard.js 中: var _typeof = require("@babel/runtime/helpers/typeof")["default"]; 因此,以我当前的认知来看,无论 vite 中 commonjsOption 如何配置编译 |
Beta Was this translation helpful? Give feedback.
-
我根据这份配置出现了另外一个问题,浏览器log 输出的行数与实际开发报错的行数不一致,我修改了sourcemap 同样没效果 |
Beta Was this translation helpful? Give feedback.
-
------------------ 原始邮件 ------------------
发件人:"云深" ***@***.***"
时 间:2022/07/06 11:45:37 周三
收件人:ant-designant-design ***@***.***"
抄送人:Subscribed ***@***.***"
主 题:Re: [ant-design/ant-design] Vite 2.x 下如何使用 antd ? (Discussion #29660)
我也碰到了,不过是后来发现的,不确定是什么插件导致的问题,后来搁置了,刚去 https://github.com/onebay/vite-plugin-imp/issues 看了一下,看起来问题不小。
如果问题不好解决的情况下,可以考虑直接使用 antd/dist/antd.less 而不用按需加载样式。
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID:
@
github
.
com>
|
Beta Was this translation helpful? Give feedback.
-
答:基于
vite-plugin-imp
,支持定制主题。更多配置可以参考我项目里的配置 vite-react/vite.config.ts。至于讨论 #29325 中提到组件无法使用的情况暂时没遇到,遇到就 PR _(:3J∠)_
Beta Was this translation helpful? Give feedback.
All reactions