Skip to content

How to make exported .d.ts files go directly in dist/... instead of dist/src/...? #1743

Answered by mesqueeb
mesqueeb asked this question in Q&A
Discussion options

You must be logged in to vote

If your tsconfig.json "include" is only pointing at stuff inside your src folder, it will not be included when building the type declarations.

  • "include": ["./**/*.vue"] this will include src folder inside distdist/src
  • "include": ["./src/**/*.vue"] this wont include src folder, it will emit directly into dist

--

If this gives you issues with your project setup, you can set up a separate tsconfig.json for emitting the type declarations.

eg. tsconfig.declaration.json

{
  "compilerOptions": {
    // ...
    "baseUrl": ".",
    "outDir": "dist"
  },
  "include": ["./src/**/*.vue"]
}

Then in your script you make sure that tsconfig.declaration.json is used instead.

package.json scripts:

  "…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mesqueeb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant