Skip to content

Does not recognize .d.mts output when build mode #156

@uhyo

Description

@uhyo

Describe the bug

When using build mode with following tsdown config to build .mts files, rolldown-plugin-dts errors with a RollupError: Unable to build .d.ts file for /path/to/index.mts error.

import { defineConfig } from 'tsdown'

export default defineConfig({
  entry: 'src/index.mts',
  dts: { build: true }
});

🧐 Likely Cause

Under build mode, the plugin only looks for .d.ts files whereas tsc is emitting .d.mts files for .mts source files.

if (outputFile.endsWith('.d.ts')) {

⛰️ Context

Why am I running the build mode? → seemingly it is the only way to have rolldown-plugin-dts emit .tsbuildinfo files. Only incremental: true wasn't effective for this purpose.

Why do I need .tsbuildinfo files? → I want to mimic tsc behavior with tsdown so that project references properly work.

Reproduction

https://github.com/uhyo/tsdown-dmts-repro

System Info

System:
    OS: Linux 6.6 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 PRO 6850U with Radeon Graphics
    Memory: 11.43 GB / 15.01 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.20.0 - /home/uhyo/.volta/tools/image/node/22.20.0/bin/node
    Yarn: 4.1.1 - /home/uhyo/.volta/tools/image/yarn/4.1.1/bin/yarn
    npm: 11.4.2 - /home/uhyo/.volta/tools/image/npm/11.4.2/bin/npm
    pnpm: 10.25.0 - /home/uhyo/.volta/bin/pnpm
    Deno: 2.2.1 - /home/uhyo/.deno/bin/deno

Used Package Manager

npm

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.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

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