omgovich / colord

👑 A tiny yet powerful tool for high-performance color manipulations and conversions
https://colord.omgovich.ru
MIT License
1.63k stars 48 forks source link

Exports map in package breaks when using with vite #83

Closed madeleineostoja closed 2 years ago

madeleineostoja commented 2 years ago

When trying to import colord with Vite (via Sveltekit), the bundler throws the following error:

import { colord } from 'colord';
Internal server error: Missing "./package.json" export in "colord" package

Not entirely sure what's going on but on the surface of it it looks like Vite requires access to the package's package.json for analysis, and since it's not exposed via exports it's throwing an error

omgovich commented 2 years ago

Hi! Yeah, you're right: we need to add package.json to "exports" field. Going to fix that as soon as I have time.

P.S. PR are also welcome :)

omgovich commented 2 years ago

Hey! Just released v2.9.2. Everything should be good now.

omgovich commented 2 years ago

Please let me know about the results: if it helps I would add the same fix to all my packages.

madeleineostoja commented 2 years ago

Yep that fixes Vite compat, thanks!