DEV Community

Discussion on: Create a React component library with Vite and Typescript

Collapse
 
wyseguyonline profile image
Jonathan Wyse

Thanks for this tutorial. It has been very helpful for me.

I'm really new to Vite and I'm really trying to give it the benefit of the doubt. I'm having an issue with a dependency (xml-parse) that uses __dirname. According to the Vite docs, this reference should be replaced, but it is ending up in my built code and causing errors in the browser (namely __dirname is not defined). I've tried multiple paths to figure this out but I seem to just be heading down one wrong path after another. Any advice for how to resolve this?

Collapse
 
nicolaserny profile image
Nicolas Erny

Hello :)
I never experienced this error.
Which OS, and node version do you use?

Collapse
 
robcrock_13 profile image
Robert Crocker

I found a solution in this article bobbyhadz.com/blog/typescript-cann...