Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate index.d.mts and index.d.cts when using mkdist entries. #390

Open
1 task
JesusTheHun opened this issue Apr 29, 2024 · 1 comment
Open
1 task

Comments

@JesusTheHun
Copy link

Describe the feature

I'm compiling a lib for both CJS and ESM, with the following config :

import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
  entries: [
    {
      builder: 'mkdist',
      input: './src/',
      outDir: './dist',
      ext: 'mjs',
      format: 'esm',
      declaration: true,
    },
    {
      builder: 'mkdist',
      input: './src/',
      outDir: './dist',
      ext: 'cjs',
      format: 'cjs',
      declaration: true,
    },
  ],
  clean: true,
  sourcemap: true,
});

As per the documentation, I expected declaration: true to generate 3 files : d.ts, d.mts and d.cts.
Yet, a single d.ts file is generated. I tried to move the declaration: true at the root, without success.

Additional information

  • Would you be willing to help implement this feature?
@cloydlau
Copy link

cloydlau commented Oct 11, 2024

This is very useful, as it would otherwise fail the @arethetypeswrong/cli detection.

It seems this PR can solve this, but don't know when it will land.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants