Skip to content

build fails with stack overflow error when resolving root tsconfig.json extends #3915

@sapphi-red

Description

@sapphi-red

Running esbuild ./input.ts in a workspace matching the following conditions fails with stack overflow error:

  • The monorepo contains a root-level tsconfig.json.
  • That root-level tsconfig.json extends a shared tsconfig.json.
  • The shared tsconfig.json is exposed via the package.json exports field.
  • The workspace has an independent tsconfig.json of its own

Notes

  • workspace-level tsconfig.json files extending one of the shared configs work fine. The issue does not arise until there is a root tsconfig.json and a workspace tsconfig.json.
  • I have not tested if using a relative extends (example: ../../tsconfig.json) resolves the issue

Reproduction

  1. Clone https://github.com/sapphi-red-repros/esbuild-tsconfig-extends-repro
  2. yarn install
  3. yarn build
  4. Error happens

Additional info

If the extends in the root tsconfig.json is removed, no error happens.
If exports is removed from the tsconfigs package and "extends": "tsconfigs/configs/tsconfig.json", is used instead for the tsconfig.json in vite-demo package and the root tsconfig.json, no error happens.

Original issue: vitejs/vite#18094

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions