Registry /
serialization / esbuild-plugin-postcss2
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
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ const postCssPlugin = require('esbuild-plugin-postcss2'); postCssPlugin.default()
✗ const postCssPlugin = require('esbuild-plugin-postcss2'); postCssPlugin()
CommonJS require returns an object with a default property. The default export is a function that creates the plugin.
default
✓ import postCssPlugin from 'esbuild-plugin-postcss2'; postCssPlugin()
✗ import { default as postCssPlugin } from 'esbuild-plugin-postcss2';
ESM default import works directly. The package ships TypeScript types.
Type definitions
✓ import type { PostCssPluginOptions } from 'esbuild-plugin-postcss2'
TypeScript types are exported for plugin options. Available since first release.
Example showing esbuild with postcss-plugin2 using autoprefixer and CSS modules with camelCase class names.
const esbuild = require('esbuild');
const postCssPlugin = require('esbuild-plugin-postcss2');
const autoprefixer = require('autoprefixer');
await esbuild.build({
entryPoints: ['src/index.js'],
bundle: true,
outfile: 'dist/bundle.js',
plugins: [
postCssPlugin.default({
plugins: [autoprefixer],
modules: {
localsConvention: 'camelCase'
}
})
]
});
Errors
Common errors & fixes
TypeError: postCssPlugin is not a function
CommonJS require returns an object; you must call .default()
fixconst postCssPlugin = require('esbuild-plugin-postcss2').default; Error: PostCSS plugin postcss-modules requires PostCSS 8
postcss-modules is incompatible with PostCSS 7
fixEnsure postcss@8 is installed as a devDependency.
Error: Cannot find module 'sass'
Sass/SCSS files require sass to be installed
Audit
Dependencies
postcssrequiredPeer dependency: PostCSS is required for plugin functionality
lessoptionalOptional peer dependency for Less preprocessor support
sassoptionalOptional peer dependency for Sass/SCSS preprocessor support
stylusoptionalOptional peer dependency for Stylus preprocessor support