{"record":{"id":"56d458be453b5f25","repo":"tailwindlabs/tailwindcss","slug":"the-browser-build-does-not-support-plugins-or-conf","errorCode":null,"errorMessage":"The browser build does not support plugins or config files.","messagePattern":"The browser build does not support plugins or config files\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@tailwindcss-browser/src/index.ts","lineNumber":174,"sourceCode":"      id,\n      base,\n      size: sheet.content.length,\n    })\n\n    return sheet\n  } catch (err) {\n    I.hit(`Failed to load stylesheet`, {\n      id,\n      base,\n      error: (err as Error).message ?? err,\n    })\n\n    throw err\n  }\n}\n\nasync function loadModule(): Promise<never> {\n  throw new Error(`The browser build does not support plugins or config files.`)\n}\n\nasync function build(kind: 'full' | 'incremental') {\n  if (!compiler) return\n\n  // 1. Refresh the known list of classes\n  let newClasses = new Set<string>()\n\n  I.start(`Collect classes`)\n\n  for (let element of document.querySelectorAll('[class]')) {\n    for (let c of element.classList) {\n      if (classes.has(c)) continue\n\n      classes.add(c)\n      newClasses.add(c)\n    }\n  }","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/tailwindlabs/tailwindcss/blob/16e94cbf7f965c5ad697e90e940b5e178efad67c/packages/@tailwindcss-browser/src/index.ts#L156-L192","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","If a plugin is truly required, compile on the server with `@tailwindcss/node` and ship the generated CSS to the browser."],"exampleFix":"/* before */\n@import \"tailwindcss\";\n@plugin \"@tailwindcss/typography\";\n\n/* after */\n@import \"tailwindcss\";\n/* use CSS-first customization only, or precompile on Node */","handlingStrategy":"validation","validationCode":"function assertNoJsDirectives(css: string) {\n  if (/@(plugin|config)\\b/.test(css)) {\n    throw new Error('Browser build cannot load @plugin/@config; use CSS-first customization')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip all @plugin/@config directives before sending CSS to the browser build.","Express customization via @theme/@utility/@custom-variant (pure CSS).","If a plugin is mandatory, compile on Node and serve the generated CSS."],"tags":["browser-build","plugins","config"],"backgroundTag":null,"analyzedSha":"16e94cbf7f965c5ad697e90e940b5e178efad67c","analyzedAt":"2026-08-12T06:02:42.469Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}