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

Feature Request: Disable parsing local tsconfig #300

Open huozhi opened 10 months ago

huozhi commented 10 months ago

When rollup-plugin-dts cannot find the tsconfig path, then it will start looking for the local tsconfig.json and parse it. But sometimes the final result of parsing can not be correct. For instance

If users gave incremental: true in compiler options but didn't specify tsBuildInfoFile cause they expect that will be filled with default value from typescript, which is .tsbuildinfo. Usually types generation don't need to pick up those project or compiler cache related configs such as composite or incremental,

Checklist

Code Snipped

Here in the plugin, when it failed to find the local config, it went to search for the local tsconfig and parse it.

https://github.com/Swatinem/rollup-plugin-dts/blob/fea09d8271572af03c9460b2055cb0c1439fab41/src/program.ts#L66-L76

Error Message

Failed with TS error

error TS5074: Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified.

Expected

I wonder if we can just have an value on tsconfig that can disable this picking up local config behavior. Such as tsconfig: false that will only use the overriden compiler options without merging with local tsconfig. That would be much easier for generating types since it can rely on a fixed compiler options config no matter how users config it.