Skip to content

Experimental tsgo support does not work in a monorepo #47

@zsilbi

Description

@zsilbi

Describe the bug

In a monorepo where each package does not have a separate tsconfig.json file, tsgo emits the whole declarations of the monorepo to the tmp directory.

I included 3 packages in the reproduction to demonstrate this:

  • my-package: the problematic package
  • my-working-package: has a tsconfig.json file in it's root with tsgo param set to "."
  • my-working-package-2: uses a relative path as tsgo param to the monorepo root

I just added a log to the handler to see what's going on in the output below:

packages/my-package build$ rolldown -c ./rolldown.config.mjs
│ The `tsgo` option is experimental and may change in the future.
│ 
│ Looking DTS for "/home/zsilbi/projects/rolldown-dts-tsgo/packages/my-package/src/index.ts" at "/tmp/rolldown-plugin-dts-CYzGVs/index.d.ts"
│ 
│  ERROR  Build failed with 1 error:
│ [plugin rolldown-plugin-dts:generate]
│ Error: tsgo did not generate dts file for /home/zsilbi/projects/rolldown-dts-tsgo/packages/my-package/src/index.ts, please check your tsconfig.
└─ Failed in 390ms at /home/zsilbi/projects/rolldown-dts-tsgo/packages/my-package

packages/my-working-package build$ rolldown -c ./rolldown.config.mjs
│ The `tsgo` option is experimental and may change in the future.
│ 
│ Looking DTS for "/home/zsilbi/projects/rolldown-dts-tsgo/packages/my-working-package/src/index.ts" at "/tmp/rolldown-plugin-dts-pbdPEm/src/index.d.ts"
│ 
│ <DIR>/index.js    chunk │ size: 0.07 kB
│ <DIR>/index.d.ts  chunk │ size: 0.08 kB
│ ✔ Finished in 132.61 ms
└─ Running...

packages/my-working-package-2 build$ rolldown -c ./rolldown.config.mjs
│ The `tsgo` option is experimental and may change in the future.
│ 
│ Looking DTS for "/home/zsilbi/projects/rolldown-dts-tsgo/packages/my-working-package-2/src/index.ts" at "/tmp/rolldown-plugin-dts-OhApJe/packages/my-working-package-2/src/index.d.ts"
│ 
│ <DIR>/index.js    chunk │ size: 0.07 kB
│ <DIR>/index.d.ts  chunk │ size: 0.08 kB
│ ✔ Finished in 133.39 ms
└─ Running...

My other observations:

  • tsconfigRaw is ignored
  • I think --noCheck flag should be enabled as the tsc does not run type checking either

Reproduction

https://github.com/zsilbi/rolldown-plugin-dts-tsgo-repro

System Info

System:
    OS: Linux 6.6 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (32) x64 AMD Ryzen 9 7950X 16-Core Processor
    Memory: 37.29 GB / 47.04 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 23.11.1 - ~/.nvm/versions/node/v23.11.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v23.11.1/bin/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v23.11.1/bin/npm
    bun: 1.2.5 - ~/.bun/bin/bun

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

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