Skip to content

SW02002: Unresolved root stylesheet

The stylesheet that the css setting selects cannot be found.

This error occurs when the stylesheet that the css setting of the project selects cannot be found. Stillwind reads the theme, utilities, and variants from that stylesheet, so it cannot compile without it.

Reported

stillwind.config.ts
import { defineConfig } from "stillwind/config";

export default defineConfig({
  projects: [
    {
      css: "./src/stilwind.css",
      files: ["src/**/*.tsx"],
    },
  ],
});

SW02002: the root CSS source cannot be unresolved

Fixed

stillwind.config.tsts
import { defineConfig } from "stillwind/config";

export default defineConfig({
  projects: [
    {
      css: "./src/stillwind.css",
      files: ["src/**/*.tsx"],
    },
  ],
});

How to fix

  • Check the path in css. It is relative to the root of the project, or to the configuration file when root is not set.
  • If you write your own integration, answer the request for the root stylesheet with its source text. Only imported stylesheets may be unresolved.