Home > Net >  How can i install antd propertly to use?
How can i install antd propertly to use?

Time:09-14

i installed antd to frontend of my app, i have this at the app.jsx

import "antd/dist/antd.css"
import { Button } from 'antd'

and now in my first component i am trying to use like this:

import antd from 'antd'
const { Card } = antd

but now i am getting this error

[plugin:vite:import-analysis] Failed to resolve import "antd/es/default/style" from ".../component.jsx". Does the file exist? .../component.jsx:1:9 1 | import 'antd/es/default/style';;import RefreshRuntime from "/@react-refresh"; | ^

in node_modules there is not have the default 'ant/es/default' folder

CodePudding user response:

If you have installed everything correctly to your node_modules folder (e.g. npm install or yarn install) you should be able to import either antd/dist/antd.css or if you just want to have the styles for the inputs antd/es/input/style/index.css

  • Related