运行前端项目发现,发现这个项目依赖于antd-mobile ,antd-mobile 又依赖于react-spring 但是antd 没有锁定版本,使用yarn 安装就会升级react-spring从而引起报错。
使用resolutions 参数,在 package.json 文件里指定特定的react-spring 版本,那么整个项目的这个依赖版本都不会升级。
{
"name": "project",
"version": "1.0.0",
"dependencies": {
"antd-mobile": "xxx",
},
"resolutions": {
"react-spring": "xxx",
}