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

Incompatible with Vite >= 3.1.0

Open jayalfredprufrock opened this issue 2 years ago • 3 comments

Building with Vite > 3.1.0 gives the following error:

error during build:
TypeError: Cannot set properties of undefined (setting 'generateBundle')
    at configResolved (/.../vite-dts/dist/cjs/plugin.js:56:33)

Worked fine prior to 3.1.0 release. Appears to be related to "this" (pun intended): https://github.com/vitejs/vite/commit/2d2f2e5

I believe the fix is to move the generateBundle function def outside of the configResolved function.

jayalfredprufrock avatar Sep 23 '22 15:09 jayalfredprufrock

same issue😅

BryanAdamss avatar Oct 20 '22 08:10 BryanAdamss

I had the same issue. One solution I found was to replace the "vite-dts" library by "vite-plugin-dts". They seem to do exactly the same thing, but the last one has more recent updates and doesn't give me an error when generating the build.

LucasNovaes2016 avatar Dec 30 '22 14:12 LucasNovaes2016

@LucasNovaes2016 vite-plugin-dts however doesn't support typescript 5+ 😭 any other workaround you know of?

mesqueeb avatar May 22 '23 04:05 mesqueeb