Skip to content

caalador/tailwind-import-failure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tailwind CSS + Vite Demo

A minimal Vite project demonstrating Tailwind CSS v4 with multiple CSS files where one imports the other.

Project Structure

src/
├── style.css        ← Entry CSS file: imports Tailwind and components.css
├── components.css   ← Imported by style.css, uses @apply utilities
└── main.js          ← Only imports style.css

Running

npm install
npm run dev

Known Issue: CSS @import Path Resolution

In src/style.css, the import of components.css must use a relative path prefix (./):

/* Works */
@import "./components.css";

/* Fails */
@import "components.css";

When the ./ prefix is omitted, Tailwind's Vite plugin treats the bare "components.css" as a package/module import rather than a relative file path. This causes a build error because no components.css package exists in node_modules.

The ./ prefix explicitly tells the resolver that this is a relative file path in the same directory, bypassing module resolution entirely.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors