vite-plugin-dts icon indicating copy to clipboard operation
vite-plugin-dts copied to clipboard

RangeError: Maximum call stack size exceeded

Open Gungy2 opened this issue 3 years ago • 3 comments

Building using the plugin runs into the following issue:

[vite:dts] Start generate declaration files...
error during build:
RangeError: Maximum call stack size exceeded
    at node_modules/@ts-morph/common/dist/typescript.js:51333:53
    at Object.trackSymbol (node_modules/@ts-morph/common/dist/typescript.js:51333:53)
    at lookupSymbolChain (node_modules/@ts-morph/common/dist/typescript.js:52311:33)
    at symbolToTypeNode (node_modules/@ts-morph/common/dist/typescript.js:52490:29)
    at typeReferenceToTypeNode (node_modules/@ts-morph/common/dist/typescript.js:51868:40)
    at typeToTypeNodeHelper (node_modules/@ts-morph/common/dist/typescript.js:51503:95)
    at serializeReturnTypeForSignature (node_modules/@ts-morph/common/dist/typescript.js:52804:24)
    at signatureToSignatureDeclarationHelper /node_modules/@ts-morph/common/dist/typescript.js:52193:42)
    at createTypeNodesFromResolvedType (node_modules/@ts-morph/common/dist/typescript.js:51938:43)
    at createTypeNodeFromObjectType (node_modules/@ts-morph/common/dist/typescript.js:51779:35)

My config is this:

export default defineConfig({
    plugins: [
        react(),
        dts({
            skipDiagnostics: false,
            logDiagnostics: true,
        })
    ],
    build: {
        sourcemap: true,
        lib: {
            entry: path.resolve(__dirname, "src/index.ts"),
            name: "project",
            fileName: "project",
        },
    },
    test: {
        globals: true,
        environment: "jsdom",
        setupFiles: "./src/setupTests.ts",
        threads: false,
    },
});

I should mention that the plugin fails with any options and that the project is sizeable (the plugin actually runs correctly when the number of components that are transpiled is reduced.

Gungy2 avatar Aug 04 '22 09:08 Gungy2

How about turn off the source map:

dts({
  compilerOptions: {
    sourceMap: false
  }
})

qmhc avatar Aug 06 '22 04:08 qmhc

Same error, unfortunately

Gungy2 avatar Aug 06 '22 09:08 Gungy2

Same error

hzx829 avatar Sep 01 '22 03:09 hzx829

Thanks a lot @qmhc

Gungy2 avatar Nov 14 '22 18:11 Gungy2

same error here.

With :

    dts({
      entryRoot: path.resolve(__dirname, 'src'),
      compilerOptions: {
        sourceMap: false
      }
    }),

I use Component Element and Chart.js in my lib, so it's big.

hugo-valcourt avatar Dec 20 '22 14:12 hugo-valcourt

Same here in a Preact application.

AliBayatMokhtari avatar Feb 29 '24 18:02 AliBayatMokhtari