tailwindlabs/tailwindcss · error · Error

The browser build does not support plugins or config files.

Error message

The browser build does not support plugins or config files.

What it means

The browser build provides a `loadModule` callback that unconditionally throws, because plugins and JavaScript config files require importing Node modules from disk, which is impossible in a browser/CDN context. It is passed as the `loadModule` option to `tailwindcss.compile` so that any `@plugin` or `@config` directive surfaces a clear message instead of a generic resolution failure.

Source

Thrown at packages/@tailwindcss-browser/src/index.ts:174

      id,
      base,
      size: sheet.content.length,
    })

    return sheet
  } catch (err) {
    I.hit(`Failed to load stylesheet`, {
      id,
      base,
      error: (err as Error).message ?? err,
    })

    throw err
  }
}

async function loadModule(): Promise<never> {
  throw new Error(`The browser build does not support plugins or config files.`)
}

async function build(kind: 'full' | 'incremental') {
  if (!compiler) return

  // 1. Refresh the known list of classes
  let newClasses = new Set<string>()

  I.start(`Collect classes`)

  for (let element of document.querySelectorAll('[class]')) {
    for (let c of element.classList) {
      if (classes.has(c)) continue

      classes.add(c)
      newClasses.add(c)
    }
  }

View on GitHub (pinned to 16e94cbf7f)

Solutions

  1. Remove all `@plugin` and `@config` directives from CSS compiled in the browser; express customization via the CSS-first API (`@theme`, `@utility`, `@custom-variant`) which is pure CSS and needs no JS module.
  2. If a plugin is truly required, compile on the server with `@tailwindcss/node` and ship the generated CSS to the browser.

Example fix

/* before */
@import "tailwindcss";
@plugin "@tailwindcss/typography";

/* after */
@import "tailwindcss";
/* use CSS-first customization only, or precompile on Node */
Defensive patterns

Strategy: validation

Validate before calling

function assertNoJsDirectives(css: string) {
  if (/@(plugin|config)\b/.test(css)) {
    throw new Error('Browser build cannot load @plugin/@config; use CSS-first customization')
  }
}

Prevention

When it happens

Trigger: Any stylesheet compiled via `@tailwindcss/browser` that contains an `@plugin "..."` directive, an `@config "./tailwind.config.js"` directive, or otherwise triggers module loading. `loadModule()` is typed `Promise<never>` and throws immediately at index.ts:174.

Common situations: Migrating a v3 config-driven setup to the browser build, or copy-pasting a stylesheet that worked under the CLI into a browser/Play CDN scenario. Users assume the browser build supports `@plugin` like the Node build.

Related errors


AI-assisted analysis of tailwindlabs/tailwindcss@16e94cbf7f (2026-08-12). Data as JSON: /api/errors/56d458be453b5f25. Report an issue: GitHub.