所以我有一棵树
├── package.json
├── tsconfig.json
└── packages
├── lib1
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ └── tsconfig.json
├── lib2
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ └── tsconfig.json
├── graph
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ └── tsconfig.json
└── peer
├── package.json
├── src
│ └── index.ts
└── tsconfig.json
其中graph取决于lib2,它取决于lib1。
{
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"lib": ["es2018"],
"moduleResolution": "node",
"declaration": true,
"strict": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"resolveJsonModule": true,
"outDir": "build"
},
"exclude": ["**/node_modules", "**/build", "**/dist"]
}
{
"extends": "../tsconfig-build.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
}
}
当我使用它构建时,编译时一切都很好
"scripts": {
":g:tsc": "cd $INIT_CWD && tsc --project tsconfig-build.json",
但是如果我尝试使用@vercel/ncc
,我会得到编译时错误,比如'rootDir' is expected to contain all source files.
"build": "ncc build src/index.ts",
我已经尝试在我的 中使用paths
and ,但它们都不适合我的目的,并且打字稿似乎没有正确查找不同的模块。当我将它指向对等体的 index.ts 时,它可以正常工作,但是没有工作空间依赖项。references
tsconfig.json
我的最终目标是能够将单个 js 文件发送到 docker 容器。我怎样才能达到我的目标?