ReviewOS

stacks/bun-plugin-dtsx

[Issue] Generate all .d.ts files in place instead of generate them in dist

#5
Closed gtrabanco opened this 9 days ago ·
9 days ago

Describe the bug

After applying https://github.com/stacksjs/bun-plugin-dts-auto/issues/4#issuecomment-1666842824 This patch to solve the issues with the package all .d.ts files are created in the path where the files are.

Captura de Pantalla 2023-08-06 a las 14 31 02

Instead of creating all those .d.ts files in the outDir:

Captura de Pantalla 2023-08-06 a las 14 32 06

Not sure if this is the expected behaviour.

Reproduction

#!/usr/bin/env bun --bun
import dts from 'bun-plugin-dts-auto';

await Bun.build({
  entrypoints: [
    './src/index.ts',
  ],
  target: 'node',
  sourcemap: "external",
  minify: true,
  root: './src',
  outdir: './dist',
  plugins: [
    dts({
      withSourceMap: true, // optional
    }),
  ],
});

console.log('Build complete ✅');

System Info

System:
    OS: macOS 12.6.7
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 42.22 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.4.0 - ~/Library/Caches/fnm_multishells/45496_1690908490075/bin/node
    npm: 9.7.2 - ~/Library/Caches/fnm_multishells/45496_1690908490075/bin/npm
    pnpm: 8.6.6 - ~/.bun/bin/pnpm
  Browsers:
    Brave Browser: 115.1.56.14
    Safari: 16.5.2


Bun: 0.7.3 (today's latest canary).

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
9 days ago

I fixed this by updating the tsconfig.json to tell it the correct output location for the .d.ts files

{
  "compilerOptions": {
   //
    "outDir": "./dist",
}
9 days ago

I fixed this by updating the tsconfig.json to tell it the correct output location for the .d.ts files

{
  "compilerOptions": {
   //
    "outDir": "./dist",
}

Yes, it works great. Was this a missconfiguration option error from me? Just to know if I have to close this issue.

When I configured Bun.build I supposed it will be using the build outDir option instead of tsconfig.

9 days ago

Thanks for creating this issue!

My apologies on the late resolution here, but we are now finally able to support this more actively now. Stacks had been consuming all of my free time, but this plugin is now finally a first-class citizen (which means great ongoing support 😃)

This is resolved in v0.4.0 by treating the tsconfig.json as a default which can be overriden by the outDir option. Also left a note in the readme.

Let me know if there is anything else I can help with!

Cheers ✌️

https://github.com/stacksjs/bun-plugin-dts-auto/compare/v0.3.0...v0.4.0

Sign in to comment on this issue.