Component library with Tailwind v4 causing @layer base error in projects using Tailwind v3 #18655
Replies: 1 comment
-
somehow after few tries #18123 it worked |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
I'm building a component library using Tailwind v4 that needs to be consumed by projects still using Tailwind v3. When importing components, I get this error:
CssSyntaxError: @layer base is used but no matching @tailwind base directive is present.
Setup Details
Component Library:
@tailwindcss/vite
)vite-plugin-lib-inject-css
Consuming Project:
Error Details
The error occurs in the consuming project when it tries to process the library's bundled CSS (
dist/main.css
). The library's CSS contains Tailwind v4 syntax like@layer base
but the consuming project's Tailwind v3 expects@tailwind base
directive.What I've Tried
Configuration Files
vite.config.ts
main.css
Question
Is there a way to build a Tailwind v4 component library that's compatible with projects using Tailwind v3?
The goal is to:
Beta Was this translation helpful? Give feedback.
All reactions