前端 / 技术 · 2022年1月18日 0

package.json 移出依赖包的 ^ 前缀

  1. 运行 npm config set save-prefix=” 和 yarn config set save-prefix false ,它们将全局有效。
  2. 在项目目录创建 .npmrc 内容为 save-prefix= ,然后在项目目录创建 .yarnrc 内容为 save-prefix ""

无配置文件

有配置文件

再安装:npm install dayjs

就没有 ^ 前缀。