anthonyshew / maestros

https://shew.dev
127 stars 8 forks source link

[Question] Is `baseUrl` needed in `tsconfig.json` ? #59

Closed jeniabrook closed 10 months ago

jeniabrook commented 10 months ago

First of all big fan of what are you doing with "Monorepo Maestros"!

I've read your TypeScript docs and wondering if we need to have a baseUrl in the tsconfig.json file that references @repo/tsconfig?

Meaning:

// packages/logger/tsconfig.json file
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "extends": "@repo/tsconfig/base.json", // Using our base config!
  "compilerOptions": {
    "tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
    "baseUrl": ".",
  },
  "include": ["."],
  "exclude": ["node_modules"]
}

If we don't need it, in which scenarios do we need it in monorepo? In conjunction with paths maybe?

anthonyshew commented 10 months ago

You're correct, baseUrl tends to get used with paths but it also can be used for non-relative module names. Documentation here: https://www.typescriptlang.org/tsconfig#baseUrl