windmill-labs/windmill · warning

CSS not found

Error message

CSS not found

What it means

The `wmill app dev` server also intercepts `/dist/bundle.css` (or `/bundle.css`) and serves `<cwd>/dist/bundle.css` with a text/css content type. If the file is absent it answers 404 with body 'CSS not found'. Like the JS-bundle check, this is a plain 404 generated inside the dev server whenever the compiled stylesheet is missing from dist/.

Source

Thrown at cli/src/commands/app/dev.ts:936

      const jsPath = path.join(process.cwd(), "dist/bundle.js");
      if (fs.existsSync(jsPath)) {
        res.writeHead(200, { "Content-Type": "application/javascript" });
        res.end(fs.readFileSync(jsPath));
      } else {
        res.writeHead(404);
        res.end("Bundle not found");
      }
      return;
    }

    // Serve the bundled CSS
    if (url === "/dist/bundle.css" || url === "/bundle.css") {
      const cssPath = path.join(process.cwd(), "dist/bundle.css");
      if (fs.existsSync(cssPath)) {
        res.writeHead(200, { "Content-Type": "text/css" });
        res.end(fs.readFileSync(cssPath));
      } else {
        res.writeHead(404);
        res.end("CSS not found");
      }
      return;
    }

    // Serve source maps
    if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
      const mapPath = path.join(process.cwd(), "dist/bundle.js.map");
      if (fs.existsSync(mapPath)) {
        res.writeHead(200, { "Content-Type": "application/json" });
        res.end(fs.readFileSync(mapPath));
      } else {
        res.writeHead(404);
        res.end("Source map not found");
      }
      return;
    }

View on GitHub (pinned to e474e8803c)

Solutions

  1. Run the bundle step so dist/bundle.css is produced (e.g. `wmill app bundle` or your project's build script), then reload.
  2. Confirm the CLI is started from the app root so process.cwd()/dist matches the real output directory.
  3. Check bundler logs for CSS/Sass/Tailwind compile errors that aborted stylesheet emission.
  4. Verify the build config emits CSS as a separate bundle.css file (CSS extraction enabled) rather than inlined into JS.
  5. Hard-reload the browser after rebuilding to bypass a cached 404 for /dist/bundle.css.

Example fix

// before: missing dist/bundle.css -> 404 'CSS not found'
ls dist  # bundle.js only

// after: rebuild with CSS extraction configured
wmill app bundle
ls dist  # bundle.js + bundle.css
Defensive patterns

Strategy: validation

Validate before calling

const cssPath = require('path').join(process.cwd(), 'dist/bundle.css');
if (!require('fs').existsSync(cssPath)) {
  console.warn(`Missing ${cssPath} - CSS bundle not built`);
}

Try / catch

try {
  const css = fs.readFileSync(path.join(process.cwd(), 'dist/bundle.css'));
  res.writeHead(200, { 'Content-Type': 'text/css' });
  res.end(css);
} catch (err) {
  if ((err as NodeJS.ErrnoException).code === 'ENOENT') {
    res.writeHead(404);
    res.end('CSS not found - rebuild the app bundle');
  } else { throw err; }
}

Prevention

When it happens

Trigger: Request for /dist/bundle.css while `fs.existsSync(process.cwd() + '/dist/bundle.css')` is false — the CSS bundle was never emitted, was deleted, or the CLI runs from a directory whose dist/ contains bundle.js but not bundle.css.

Common situations: Bundler configuration emits JS but CSS extraction fails or is disabled; partial/cleaned dist directory; running dev from the wrong folder; first page load racing an in-progress build; upgrading the bundler and losing the CSS output config.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/2835274b4d375172. Report an issue: GitHub.