mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.69k stars 1.89k forks source link

Odd Typescript error with vite #114

Closed DavidWells closed 3 years ago

DavidWells commented 3 years ago

Had some odd typescript errors today trying to use mantine in a new vite app.

I added the example app from https://github.com/mantinedev/mantine-next-example/blob/master/components/TodoList.jsx to this repo https://github.com/DavidWells/redux-toolkit-vite-example and got these errors

image

I wasn't able to find any references to emotion via github search https://github.com/mantinedev/mantine/search?q=emotion.

aside: Vite uses esmodules and I've seen it act odd with different NPM packages but it's crazy fast at starting/building. Would be cool to get mantine working with a vite example 😃


You can test this out with a fresh vite app via:

npm init @vitejs/app my-app -- --template react-ts
rtivital commented 3 years ago

I guess this is an error in your setup, Mantine does not use emotion. I've set up example project with vite – everything works fine, you can try it out here – https://github.com/rtivital/vite-mantine-example

To bootstap your repo with mantine and vite use commands from vite docs:

DavidWells commented 3 years ago

https://github.com/rtivital/vite-mantine-example works! Thanks for this.

The odd part about that emotion error is the file path is pointing to the /title/title.d.ts file in mantine core dir and it appears like the built files were missing

image

Anywho, closing this out as it's probably some random npm install issue.