在creat-react-app 中引入 antd 如下
import {Button} from 'antd'
无论什么组件,只要是antd 控制台就会报错如下
./node_modules/ua-parser-js/src/ua-parser.js
1010:12-19 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
浏览器就是这样显示的
×
Error: Cannot find module "."
▶ 50 stack frames were collapsed.
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.
你这样引用应该要配置babel-plugin-import(按需加载组件)