UnoCSS installation issue related to ESM imports

Hi. I just started a brand new solid project and then added UnoCSS. But does not seem to work, it gives the following error:
"unocss/vite" resolved to an ESM file. ESM file cannot be loaded by `require`. See https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details. [plugin externalize-deps]
"unocss/vite" resolved to an ESM file. ESM file cannot be loaded by `require`. See https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details. [plugin externalize-deps]
Downgrading unocss to 0.58.9 fix the issue. Maybe it is something related to the breaking changes in https://github.com/unocss/unocss/releases/tag/v0.59.0 ?
GitHub
Release v0.59.0 · unocss/unocss
🚨 Breaking Changes Move to ESM-only and fix package exports  -  by @kwaa, @userquin, @antfu, Chris and Anthony Fu in #3380 (41bc8) preset-mini: RingWidth default changed to 3px to align with Ta...
2 Replies
rafael79
rafael79OP7mo ago
I also am not sure if it is something on solid side or unocss side.
peerreynders
peerreynders7mo ago
It's a vite thing. Change vite.config.ts to vite.config.mts Alternately add "type":"module", to your package.json "type" Node version also plays into it, you should at least have v18 (I'm running v20).
Want results from more Discord servers?
Add your server