Floffah / esbuild-plugin-d.ts

🔌 Build Typescript declarations with ESBuild
http://npm.im/esbuild-plugin-d.ts
MIT License
57 stars 6 forks source link

bug: Sometimes it doesn’t generate dts correctly, I’m not sure what happened, but obviously something went wrong #5

Closed rxliuli closed 4 months ago

rxliuli commented 2 years ago

image

{
  "compilerOptions": {
    "target": "ESNext",
    "lib": ["ESNext"],
    "outDir": "./dist",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "strict": true,
    "module": "ESNext",
    "moduleResolution": "node",
    "sourceMap": true,
    "declaration": true,
    "declarationMap": true
  },
  "include": ["src"],
  "typedocOptions": {
    "entryPoints": ["src/index.ts"],
    "out": "docs",
    "readme": "README.md",
    "gitRemote": "origin"
  }
}

Reproducible steps

  1. git clone https://github.com/rxliuli/liuli-tools
  2. cd liuli-tools
  3. yarn
  4. yarn setup
  5. cd libs/i18next-util/dist

See error

rxliuli commented 2 years ago

In the end, I wrote similar logic to generate type definitions, but not as a plug-in of esbuild, but as an independent function, because it can generate type definitions only once when esbuild is run multiple times

Floffah commented 2 years ago

I will try and fix this asap, in the mean time I recommend a tool like tsup which generates correct definition files (and is built on top of esbuild)

rxliuli commented 2 years ago

I will try and fix this asap, in the mean time I recommend a tool like tsup which generates correct definition files (and is built on top of esbuild)

Since we maintain the company's internal cli program, we cannot directly use a new one, and generally expect to be superimposed on the original cli

In addition, I have handled this function by myself. When packaging multiple bundles (cjs/esm), it is unreasonable as an esbuild plugin. It seems that it needs to be generated twice. Even if incremental compilation is used, comparison is required.

Floffah commented 2 years ago

I don't have a lot of time to look at this right now however I will open this again in case there is anyone out there who wants to fix this until I am available!