Registry / devops / esbuild-postcss

esbuild-postcss

JSON →
library0.0.4jsnpmunverified

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.

npm install esbuild-postcss
INSTALL
IMPORT
SIG · ESBUILD-POSTCSS
E
esbuild-postcss
devopsjavascriptv0.0.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const postcss = require('esbuild-postcss')
import postcss from 'esbuild-postcss'
Package is CJS-only; ESM imports will fail.
postcss
import postcss from 'esbuild-postcss'
import { postcss } from 'esbuild-postcss'
Default export is a function. Named export does not exist.
Options
const postcss = require('esbuild-postcss'); const result = postcss({ extensions: ['.css'] })
Options object passed to the default export function.

Shows how to use the esbuild-postcss plugin: create an esbuild build with a CSS entry point and the plugin.

const esbuild = require('esbuild'); const postcssPlugin = require('esbuild-postcss'); esbuild.build({ entryPoints: ['src/styles.css'], bundle: true, outdir: 'dist', plugins: [postcssPlugin()], }).catch(() => process.exit(1));
Debug
Known issues
breakingThe package is CJS-only. Using `import` syntax will cause a runtime error.
fix
Use `require('esbuild-postcss')` or add a bundler transform.
affects: >=0.0.1
gotchaThe plugin expects PostCSS to be configured via a postcss.config.js file or passed via options; it does not apply default transformations.
fix
Create a postcss.config.js with your plugins and options.
affects: >=0.0.1
gotchaOnly 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.
fix
Pass a custom `extensions` array, e.g., `postcssPlugin({ extensions: ['.css', '.pcss'] })`.
affects: >=0.0.1
gotchaThe plugin does not handle source maps automatically; you must configure PostCSS source maps separately.
fix
Add source map support in your postcss.config.js.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'esbuild-postcss'
The package is not installed or missing from dependencies.
fix
Run `npm install esbuild-postcss --save-dev`
TypeError: postcss is not a function
Using a named import `{ postcss }` when the package exports a default function.
fix
Use `import postcss from 'esbuild-postcss'` or `const postcss = require('esbuild-postcss')`
Error: PostCSS plugin postcss-xxx requires PostCSS 8
PostCSS 8 is required but an older version is installed.
fix
Run `npm install postcss@^8.0.0`
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency: esbuild is required to use the plugin
postcssrequiredpeer dependency: PostCSS 8+ is required for CSS transformation
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-postcss — npm install esbuild-postcss · libregistry