rollup-plugin-windicss
raw JSON → 1.9.4 verified Mon Apr 27 auth: no javascript
A Rollup plugin for Windi CSS, an on-demand Tailwind CSS replacement that generates utilities at build time instead of scanning a massive pre-generated stylesheet. Version 1.9.4 is current, maintained as part of the vite-plugin-windicss monorepo. It provides fast compilation, supports Tailwind CSS v2 configs, utility groups, CSS @apply/@screen transforms, and Vite/HMR compatibility. Peer dependency on Rollup. Differentiates from Tailwind CSS by being faster for large projects and generating only used styles.
Common errors
error The "path" argument must be of type string or an instance of URL. Received undefined ↓
cause Plugin version 1.8.10 had a bug when config file was not found but required.
fix
Update to version >=1.8.11 or ensure a windi.config.js exists.
error SyntaxError: Cannot use import statement outside a module ↓
cause Using require() with ESM-only package; rollup-plugin-windicss is ESM-only.
fix
Use import syntax and ensure rollup.config.mjs or "type": "module" in package.json.
error Module not found: Error: Package path ./utils is not exported ↓
cause Accessing internal modules that are not exported from package.
fix
Only use public API exports; do not import from subpath "rollup-plugin-windicss/utils".
Warnings
gotcha The plugin is part of the vite-plugin-windicss monorepo; ensure compatibility with Rollup version (peer dep *). ↓
fix Use Rollup >=2.0.0; check for breaking changes in monorepo releases.
deprecated Windi CSS project is deprecated in favor of Tailwind CSS v3. New projects should consider Tailwind CSS or UnoCSS. ↓
fix Migrate to Tailwind CSS v3 or UnoCSS; rollup-plugin-windicss still works for existing projects.
gotcha Virtual CSS module 'virtual:windi.css' must be imported after the plugin is added to config, or it won't be resolved. ↓
fix Ensure the plugin is added to the rollup config before the import in your source.
breaking Version 1.9.0 dropped support for some older Rollup versions; require Rollup >=2.60.0. ↓
fix Update Rollup to ^2.60.0 or higher.
Install
npm install rollup-plugin-windicss yarn add rollup-plugin-windicss pnpm add rollup-plugin-windicss Imports
- WindiCSS wrong
const WindiCSS = require('rollup-plugin-windicss')correctimport WindiCSS from 'rollup-plugin-windicss' - defineConfig wrong
const { defineConfig } = require('rollup-plugin-windicss')correctimport { defineConfig } from 'rollup-plugin-windicss' - VirtualModule wrong
import 'windi.css'correctimport 'virtual:windi.css'
Quickstart
// rollup.config.mjs
import WindiCSS from 'rollup-plugin-windicss';
export default {
input: 'src/main.js',
output: { dir: 'dist', format: 'esm' },
plugins: [WindiCSS()]
};
// src/main.js
import 'virtual:windi.css';
console.log('Hello, Windi CSS!');