Closed julin69 closed 3 years ago
应该是cnpm install antd时候包没有安装完整,导致引入Button失败,可以试试把antd uninstall,重新用npm安装
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
node -v v14.15.4
dva -v dva-cli version 0.10.1 dva version 2.4.1 roadhog version 2.5.0-beta.4
dva new objectname cd objectname
cnpm install antd babel-plugin-import --save
编辑 .webpackrc,使 babel-plugin-import 插件生效 { "extraBabelPlugins": [ ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" }] ] }
然后在组件中 import { Button } from 'antd';
然后页面就报错了![image](https://user-images.githubusercontent.com/34527159/109581108-c8aa8180-7b36-11eb-9c55-a145f7523fbc.png)