microsoft / microsoft/TypeScript

project reference { "path": "" } is ignored

未关闭
#63,848 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

## Steps to reproduce

In every project folder I have a `./tsconfig.build.json` which my build script finds and compiles.
In one project I have no subdirectories but only flat files, so I reference "the same directory".

`./tsconfig.build.json`
```json
{
"$schema": "http://json.schemastore.org/tsconfig",
"references": [
{ "path": "" }
],
"files": [],
"include": []
}
```

The file `./tsconfig.json` contains the final compile:
```json
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "../tsconfig_base",
"include": ["./*.ts"]
}
```

Looks silly, but I also have `./tsconfig.build.json` which have this:
```
"references": [
{ "path": "Worker/" },
{ "path": "" },
```

## Behavior with `typescript@6.0`

Compiles
```
> node_modules\.bin\tsc --build Folder/tsconfig.build.json --force --verbose
[17:36:53] Projects in this build:
* Folder/tsconfig.json
* Folder/tsconfig.build.json
...
```

## Behavior with `tsgo`

```
> node_modules\.bin\tsgo --build Folder/tsconfig.build.json --force --verbose
[05:37:22 PM] Projects in this build:
* Folder/tsconfig.build.json
...
```

When I change the file `./tsconfig.build.json` to that:
```json
{
"$schema": "http://json.schemastore.org/tsconfig",
"references": [
{ "path": "./" }
],
"files": [],
"include": []
}
```
It compiles like a charm, but still I wanted to report the compiler difference.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用所示的 tsconfig.build.json 以及 `tsc --build` 和 `tsgo --build` 命令重现差异,并比较它们的详细项目列表。跟踪每个命令如何解析 `references` 的路径值 `""` 和 `"./"`;当空路径与当前目录路径得到一致处理时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
go, typescript
领域
build-system
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
62/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。