{"id":21286,"library":"esbuild-postcss","title":"esbuild-postcss","description":"A plugin for esbuild that seamlessly integrates PostCSS processing into the build pipeline. Version 0.0.4, with no recent updates. It works by matching file extensions (default .css) and running PostCSS transforms via a PostCSS instance configured in your project's postcss.config.js file. Unlike postcss-cli or webpack postcss-loader, this plugin is lightweight and leverages esbuild's speed. It requires esbuild and PostCSS 8+ as peer dependencies. Note: the package uses CommonJS require() style and does not expose an ESM module, which may cause issues in ESM-only environments.","status":"active","version":"0.0.4","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/karolis-sh/esbuild-postcss","tags":["javascript","esbuild","plugin","postcss","typescript"],"install":[{"cmd":"npm install esbuild-postcss","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-postcss","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-postcss","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: esbuild is required to use the plugin","package":"esbuild","optional":false},{"reason":"peer dependency: PostCSS 8+ is required for CSS transformation","package":"postcss","optional":false}],"imports":[{"note":"Package is CJS-only; ESM imports will fail.","wrong":"import postcss from 'esbuild-postcss'","symbol":"default","correct":"const postcss = require('esbuild-postcss')"},{"note":"Default export is a function. Named export does not exist.","wrong":"import { postcss } from 'esbuild-postcss'","symbol":"postcss","correct":"import postcss from 'esbuild-postcss'"},{"note":"Options object passed to the default export function.","wrong":null,"symbol":"Options","correct":"const postcss = require('esbuild-postcss'); const result = postcss({ extensions: ['.css'] })"}],"quickstart":{"code":"const esbuild = require('esbuild');\nconst postcssPlugin = require('esbuild-postcss');\n\nesbuild.build({\n  entryPoints: ['src/styles.css'],\n  bundle: true,\n  outdir: 'dist',\n  plugins: [postcssPlugin()],\n}).catch(() => process.exit(1));","lang":"javascript","description":"Shows how to use the esbuild-postcss plugin: create an esbuild build with a CSS entry point and the plugin."},"warnings":[{"fix":"Use `require('esbuild-postcss')` or add a bundler transform.","message":"The package is CJS-only. Using `import` syntax will cause a runtime error.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Create a postcss.config.js with your plugins and options.","message":"The plugin expects PostCSS to be configured via a postcss.config.js file or passed via options; it does not apply default transformations.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Pass a custom `extensions` array, e.g., `postcssPlugin({ extensions: ['.css', '.pcss'] })`.","message":"Only files with extensions in the `extensions` option (default ['.css']) are processed. If you have .pcss or .postcss files, they are ignored unless you add the extension.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Add source map support in your postcss.config.js.","message":"The plugin does not handle source maps automatically; you must configure PostCSS source maps separately.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install esbuild-postcss --save-dev`","cause":"The package is not installed or missing from dependencies.","error":"Error: Cannot find module 'esbuild-postcss'"},{"fix":"Use `import postcss from 'esbuild-postcss'` or `const postcss = require('esbuild-postcss')`","cause":"Using a named import `{ postcss }` when the package exports a default function.","error":"TypeError: postcss is not a function"},{"fix":"Run `npm install postcss@^8.0.0`","cause":"PostCSS 8 is required but an older version is installed.","error":"Error: PostCSS plugin postcss-xxx requires PostCSS 8"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}