Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When extending a base config include and exclude get overwritten by base config. #86

Open
2 tasks
floratmin opened this issue Dec 18, 2024 · 1 comment
Open
2 tasks
Labels
bug Something isn't working pr welcome

Comments

@floratmin
Copy link

Problem

I have a monorepo with the following tsconfig.lib.json for my library:

{
  "extends": [
    "./tsconfig.json",
    "../../../../../../configs/typescript/tsconfig.jsx.json",
  ],
  "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*.d.ts"],
  "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "t.ts"]
}

With the following tsconfig.json in the same directory:

{
  "extends": "../../../../../../tsconfig.base.json",
  "compilerOptions": {},
  "files": [],
  "include": [],
  "references": [
    {
      "path": "./tsconfig.lib.json"
    },
    {
      "path": "./tsconfig.spec.json"
    }
  ]
}

And with the following tsconfig.base.json in the root directory:

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowImportingTsExtensions": true,
    ...
  },
  "exclude": ["node_modules", "tmp"]
}

When I parse tsconfig.lib.json I want to have the values from include and exclude from this file, but when I get the tsconfig with getTsconfig('path/to/tsconfig.lib.json') I get the exclude from the tsconfig.base.json file and no include at all.

Also the config from tsconfig.jsx.json extended in tsconfig.lib.json does not get merged.

Expected behavior

All config files should be merged by their priority.

Minimal reproduction URL

https://github.com/floratmin/get-tsconfig-error

Version

9.15.0

Node.js version

v22.8.0

Package manager

pnpm

Operating system

Linux

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work financially will speed up resolution

  • I'm willing to offer financial support
@floratmin floratmin added the bug Something isn't working label Dec 18, 2024
@privatenumber
Copy link
Owner

Thanks for filing this! I confirmed it's a bug.

If anyone can work on it, please feel free to open a fix PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pr welcome
Projects
None yet
Development

No branches or pull requests

2 participants