Skip to content

[Bug]: imports with only types are removed even if verbatimModuleSyntax is true #3777

@sapphi-red

Description

@sapphi-red

Reproduction link or steps

  1. Open https://stackblitz.com/edit/github-nci4o6nk-2qbuhwjk?file=src%2Findex.ts,src%2Fa.ts,tsconfig.json,dist%2Findex.js
  2. npm i runs automatically
  3. npm run build runs automatically
  4. See dist/index.js not including console.log('a') that exists in src/a.ts

What is expected?

console.log('a') to be included in the output.

What is actually happening?

console.log('a') is not included in the output.

System Info

Stackblitz

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    rolldown: 1.0.0-beta.3-commit.4666fd5 => 1.0.0-beta.3-commit.4666fd5

Any additional comments?

When verbatimModuleSyntax is enabled, import './a.ts'; should be preserved.

(This should not affect rolldown-vite as the TS -> JS conversion is handled by Vite)

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions