Giter Club home page Giter Club logo

Comments (4)

qmhc avatar qmhc commented on June 3, 2024

Thanks for using this plugin.

For the first point, is not a bug in this plugin, because you used tsc without --noEmit parameter.

The second point strictly is not a bug.

The reason is when all files are in one directory and without rootDir config in tsconfig.json, the root directory in ts will be inferred to that only one directory, so incorrect path calculation occurred.

Currently you can add { "rootDir": "." } to your tsconfig.json solve this problem succinctly.

from vite-plugin-dts.

axelthat avatar axelthat commented on June 3, 2024

@qmhc For the first point, do you mean in package.json I should do "build": "tsc --noEmit && vite build"? Because I did that and it gives me the following error,

tsconfig.json:9:9 - error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.

9         "emitDeclarationOnly": true,

Regarding the second point the dts file is generated as main.d.ts. Shouldn't it be index.d.ts? Because typescript complains that there are no types for the lib.

Screen Shot 2021-06-09 at 8 02 42 AM

from vite-plugin-dts.

qmhc avatar qmhc commented on June 3, 2024

@sanjade If you only want to check your typescript you needn't add emitDeclarationOnly option.

The .d.ts files named by the source files name, for your situation I think you should add types option in your lib package.json to specify the entry of type analysis, just like main option.

{
  "main": "dist/viteproject.cjs.js",
  "types": "dist/main.d.ts",
}

I recommend you to try @microsoft/api-extractor if you want to bundle all declaration in one file.

The staticImport option is for using @microsoft/api-extractor.

from vite-plugin-dts.

axelthat avatar axelthat commented on June 3, 2024

Thanks a lot!

from vite-plugin-dts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.