antd 在 create-react-app 下无法使用?

2020-05-01 20:19:10 +08:00
 Keanuo

一个初始化的 create-react-app 框架,在 App.js 中引入了 antd,除此之外其他什么都没干,编译之后就报错。大家有遇到这种情况的吗?


Compiled with warnings.

./node_modules/moment/src/lib/locale/locales.js Critical dependency: the request of a dependency is an expression

2496 次点击
所在节点    前端开发
5 条回复
GDC
2020-05-01 20:49:49 +08:00
一直在 cra 里用 antd 没遇过你说的情况
worldtongfb
2020-05-01 21:54:59 +08:00
我也卡这里了,应该是某个组件引入 moment 然后配置不对把
Keanuo
2020-05-01 22:10:56 +08:00
@worldtongfb 对,去 package-lock.json 里把 moment.js 的版本锁在 2.24.0 就好了
worldtongfb
2020-05-01 22:26:28 +08:00
@Keanuo #3 嗯 可以了 谢谢
rokeyzki
2020-05-02 17:24:29 +08:00
@GDC 因为这是 antd 最新版本的问题

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/667953

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX