猿问

引入 antd 就报 Critical dependency: require fun... 的错误

在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.


不负相思意
浏览 3476回答 1
1回答

潇湘沐

你这样引用应该要配置babel-plugin-import(按需加载组件)
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答