unplugin-dts icon indicating copy to clipboard operation
unplugin-dts copied to clipboard

Cannot find modules (third-party libraries) with Yarn 3

Open mohannad-s-awad opened this issue 3 years ago • 7 comments

Greetings and thank you for this useful plugin.

I tried to you use your plugin with a Yarn 3 setup but it seems to struggle finding modules as there is no node_modules folder with Yarn 3. Any clue?

mohannad-s-awad avatar Aug 20 '22 08:08 mohannad-s-awad

I'm also experiencing this problem, everything was fine until I switched yarn 3 to use Plug'n'Play thereby eliminating node_modules...

image

brendanhealey avatar Dec 31 '22 13:12 brendanhealey

I face the exact same issue with Yarn3 PnP. Is there another way to get this working without opting out of Yarn PnP

aruntj avatar Mar 12 '23 19:03 aruntj

Did anyone find a workaround yet? This basically makes it unusable for our library since most generated types resolve to any.

magnattic avatar Apr 24 '23 21:04 magnattic

No workaround for this plugin, but you can chain a npm script that runs tsc after vite e.g.

  "dev": "yarn build-src -w & yarn build-dts --watch",
  "build": "yarn build-src && yarn build-dts",
  "build-src": "vite build",
  "build-dts": "tsc --project tsconfig.dts.json"

./tsconfig.dts.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "declaration": true,
    "noEmit": false,
    "emitDeclarationOnly": true,
    "outDir": "dist"
  }
  "include": ["src"]
}

psychobolt avatar Apr 24 '23 22:04 psychobolt

Awesome, that works for me, thanks!

Would be nice if the plugin could be updated to do the same.

magnattic avatar Apr 25 '23 10:04 magnattic

@qmhc this is occurring with yarn v3 and nodeLinker set to node_modules – so, not using pnp and still facing this issue. Occurs regardless of vite-plugin-dts version used.

joeyfigaro avatar Jun 20 '24 17:06 joeyfigaro