Quramy / lerna-yarn-workspaces-example

How to build TypeScript mono-repo project with yarn and lerna
MIT License
898 stars 94 forks source link

Why do you have two tsconfig setting? #1

Closed rohmanhm closed 6 years ago

rohmanhm commented 7 years ago

After I look into your code, I found that in each package you have 2 tsconfig. First is tsconfig.json and the other is tsconfig.base.json

When you run npm script prepublish it will compile using tsconfig.base.json configuration. "prepublish": "tsc -p tsconfig.build.json" So, Do we still need the tsconfig.json since you don't use it?

timeyr commented 7 years ago

The tsconfig.json file is used by the IDE (in order to point the typescript service to the actual sources), the tsconfig.base.json is used for the actual compilation.

kachkaev commented 6 years ago

Just wondering: what harm would there be if packages/*/tsconfig.json also had this?

"compilerOptions": {
    "rootDir": "src",
    "outDir": "lib"
}

What would stop working in the IDE?

tommedema commented 6 years ago

@kachkaev did you ever figure this out?

Also, @timeyr, which setup would you use to get tslint working? I currently have:

"lint": "tslint --fix --project tsconfig.json --config ../../tslint.json"

in my packages' package.json but this causes tslint to not resolve local dependencies, resulting in linting errors when there aren't any

Quramy commented 6 years ago

Using ts 2.x, we needed 2 tsconfig. One is for IDE, another is to build package.

ts 3.0.x’s project reference feature allows to integrate the both functions. So I’ve updated README.