How nextjs supports antd

using the nextjs framework, how to introduce antd, and load on demand.

Mar.17,2021

refer to https://github.com/zeit/next.


introduce antd-related files


the same question, have you solved


yarn add antd
yarn add babel-plugin-import
// .babelrc
{
  "presets": ["next/babel"],
  "plugins": [
    [
      "import",
      {
        "libraryName": "antd",
        "style": "css" // `style: true`  less 
      }
    ]
  ]
}
//
import { Button, Switch } from "antd";

<>
    <Button>Index page</Button>
    <Switch defaultChecked onChange={onChange} />
  </>
Menu