使用create-react-app创建项目,二——引入ant方法(一

  1. 扩展项目(需要创建git默认文件)

      具体步骤如下:

    a.git init

    b.git add .

    c.git commit -m "..."

  2. npm install babel-plugin-import --save-dev
    

      

  3. npm install antd -s
    

      

  4. npm run eject
    

      

  5. 在package.json文件中找到babel,修改成如下格式即可
    "babel": {
        "presets": [
          "react-app"
        ],
        "plugins": [
          [
            "import",
            {
              "libraryName": "antd",
              "style": "css"
            }
          ]
        ]
      },