qmhc / vite-plugin-dts

A Vite plugin for generating `.d.ts` files.
MIT License
1.27k stars 85 forks source link

Unable to follow symbol for "Omit" #369

Closed wowblvck closed 2 months ago

wowblvck commented 2 months ago

Describe the bug

When trying to build a component library, an error occurs:

[vite:dts] Internal Error: Unable to follow symbol for "Omit"

If you disable rollupTypes, the build runs normally.

The problem is very similar #367

vite.config.js:

import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import svgr from "vite-plugin-svgr";
import mkcert from "vite-plugin-mkcert";

import { libInjectCss } from "vite-plugin-lib-inject-css";

import { resolve } from "path";

const resolvePath = (path: string) => resolve(__dirname, path);

import { peerDependencies } from "./package.json";

export default defineConfig(() => {
  return {
    plugins: [
      react(),
      svgr(),
      libInjectCss(),
      dts({ rollupTypes: true }),
      mkcert(),
    ],
    build: {
      target: "esnext",
      minify: true,
      cssCodeSplit: true,
      lib: {
        entry: resolvePath("lib/index.ts"),
        formats: ["es", "cjs"],
        fileName: "index",
      },
      rollupOptions: {
        external: ["react/jsx-runtime", ...Object.keys(peerDependencies)],
        input: {
          main: resolvePath("lib/index.ts"),
          toast: resolvePath("lib/assets/styles/toast.css"),
        },
      },
      emptyOutDir: true,
    },
  };
});

Reproduction

Not related

Steps to reproduce

No response

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 6800H with Radeon Graphics
    Memory: 3.82 GB / 15.19 GB
  Binaries:
    Node: 20.16.0
    npm: 10.8.2
  npmPackages:
    @vitejs/plugin-react-swc: ^3.7.0 => 3.7.0
    vite: ^5.4.0 => 5.4.0
    vite-plugin-dts: ^4.0.2 => 4.0.2

Validations

qmhc commented 2 months ago

Fix by #366.