Skip to content

Pass dts parameter to outputOptions option #371

@sapphi-red

Description

@sapphi-red

Clear and concise description of the problem

Since outputOptions.footer is called for dts files, I had to write a little more code to only add code to non-dts files.
https://github.com/vitejs/vite-plugin-react/blob/ca97a985fd570260096125e67687dca63bd27eae/packages/plugin-react-swc/tsdown.config.ts#L24-L35

Suggested solution

It would be nice to have a dts boolean parameter passed to outputOptions option.

tsdown/src/options/types.ts

Lines 180 to 185 in e71a9b6

outputOptions?:
| OutputOptions
| ((
options: OutputOptions,
format: NormalizedFormat,
) => Awaitable<OutputOptions | void | null>)

export interface Options {
  outputOptions?:
    | OutputOptions
    | ((
        options: OutputOptions,
        format: NormalizedFormat,
        dts: boolean
      ) => Awaitable<OutputOptions | void | null>)
}

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions