dvajs / dva

🌱 React and redux based, lightweight and elm-style framework. (Inspired by elm and choo)
https://dvajs.com/
MIT License
16.24k stars 3.17k forks source link

引入antd报错 #2423

Closed julin69 closed 3 years ago

julin69 commented 3 years ago

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

caidongwei commented 3 years ago

应该是cnpm install antd时候包没有安装完整,导致引入Button失败,可以试试把antd uninstall,重新用npm安装

stale[bot] commented 3 years ago

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.