0

我使用 Nx 作为我的 monorepo 管理工具。当我编写两个这样的可发布库时:

1.@测试/父母

产生于nx generate @nrwl/node:library --name=parent --buildable --importPath=@test/parent --publishable

//libs/parent/src/lib/parent.ts
import * as moment from 'moment'
export function get_time(){
  let res = moment().format();
  return res;
}
.....

2.@测试/孩子

产生于nx generate @nrwl/node:library --name=child --buildable --importPath=@test/child --publishable

import { get_time} from "@test/parent";
export function time(){
.....
  return get_time();

}

我想发布@test/child包。所以我建造它们。但是在@test/childdist/package.json 文件中。我发现:

"dependencies": {
    "@test/core": "0.0.1",
    "moment": "^2.29.1"
  }

@test/child包含的@test/parent依赖项moment

我很困惑为什么会这样。我认为momentis@test/parent的依赖,所以它不应该包含在@test/child' 的依赖中。

4

0 回答 0