-
Hello There, I'm currently facing some issues while building an npm component library using React, Vite, and TailwindCSS v4. Problem:
Here’s my UI library repo https://github.com/Alope-Community/alope-ui (on unstable branch) Any insights would be greatly appreciated. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Answered by
wongjn
Aug 18, 2025
Replies: 1 comment 1 reply
-
Consider:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
MrFatra
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider:
@import "tailwindcss";
fromsrc/index.css
. Consumer apps should contain this@import
statement, not the library, otherwise you may get a double-up of Tailwind CSS rules.@source
directive(s) that point to its own library files that contain Tailwind class names. By default, Tailwind in a consumer will ignorenode_modules
when scanning for class names. This is where this library would sit in the file system in the consumer, hence both your problems occur.src/index.css
is shipped as a production file. This is so that consumers can@import
this file. You can relocate the production version of this file if you so wish but it should contain the uncompiled CSS…