Swatinem / rollup-plugin-dts

A rollup plugin to generate .d.ts rollup files for your typescript project
GNU Lesser General Public License v3.0
816 stars 71 forks source link

Unable to reference itself as a dependency #309

Closed NWYLZW closed 6 months ago

NWYLZW commented 6 months ago

Checklist

Description

When the content of 'dist' exists and there is an index input or 'outdir' is not set in tsconfig, it will result in a compilation failure.

Code Snipped

reproduce repository.

  ...
  "scripts": {
    "error-when-dist-is-exsist": "rollup -c rollup.config.mjs && rollup -c rollup.config.mjs",
    "add-outdir-option-will-success": "rollup -c rollup.config.add-outdir-option.mjs",
    "remove-index-input-will-sucess": "rollup -c rollup.config.remove-index-input.mjs"
  }
  ...

The first command describes the problem encountered, while the second and third command are two possible solutions I found. However, I don't think I should go with either of them, so I wanted to ask how the maintainer should handle this situation.

Error Message

[!] RollupError: src/a.ts (2:7): Expected '{', got 'type' (Note that you need plugins to import files that are not JavaScript)
src/a.ts (2:7)
1: export const a = 1
2: export type A = 1
          ^
RollupError: Expected '{', got 'type'
NWYLZW commented 6 months ago

fixed in #310