这是indexloc提供的服务,不要输入任何密码
Skip to content

Option to specify outExtension for generated dts files? #939

@errmayank

Description

@errmayank

Like we can modify output extension of JavaScript files is there also a way to do the same for type definition files?

I tried returning this because dts was showing up in the autocomplete return options but it doesn't work.

format: ['cjs', 'esm'],
outExtension({ format }) {
  switch (format) {
    case 'cjs': {
      return { js: '.cjs', dts: '.d.cts' };
    }
    case 'esm': {
      return { js: '.mjs', dts: '.d.mts' };
    }
    default: {
      return { js: '.js', dts: '.d.ts' };
    }
  }
}

Output type definition files generated after building have extensions .d.ts and .d.cts which is the default since my package is of type module. Is there a way to do this?

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