antd 中的 DatePicker 抛出错误 import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs' was not found

DatePicker in antd throwing error import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs' was not found

克隆新项目并安装所有依赖项后,测试失败并出现以下错误

This dependency was not found:

rc-picker/lib/generate/dayjs in ./node_modules/@rjsf/antd/dist/es/components/DatePicker/index.js

import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
import generatePicker from 'antd/lib/date-picker/generatePicker';
var DatePicker = generatePicker(dayjsGenerateConfig);
export default DatePicker;

通过替换 URL

解决上述问题

import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';

import dayjsGenerateConfig from 'antd/node_modules/rc-picker/lib/generate/dayjs'

代码如下所示

import  dayjsGenerateConfig from 'antd/node_modules/rc-picker/lib/generate/dayjs'
import generatePicker from 'antd/lib/date-picker/generatePicker';
var DatePicker = generatePicker(dayjsGenerateConfig);
export default DatePicker;