Home > Enterprise >  antd 5 Module not found: Error: Can't resolve 'antd/dist/antd.less'
antd 5 Module not found: Error: Can't resolve 'antd/dist/antd.less'

Time:11-22

I've updated antd to 5.0.0. I've these imports which are giving error now.

@import '~antd/es/style/themes/default.less';
@import '~antd/dist/antd.less';

what should I replace with in new versions?

CodePudding user response:

From v4 to v5, antd css files are no longer included in package.

Since CSS-in-JS supports importing on demand, the original antd/dist/antd.css has also been abandoned.

If you need to reset some basic styles, please use import antd/dist/reset.css. So just delete these codes if you don't need to reset bacis styles.

refrence: https://ant.design/docs/react/migration-v5

CodePudding user response:

Instead of those imports, import this in App.js

import 'antd/dist/reset.css';

  • Related