Registry / serialization / esbuild-plugin-postcss2

esbuild-plugin-postcss2

JSON →
library0.1.2jsnpmunverified

An optimized, type-friendly PostCSS plugin for esbuild with support for CSS preprocessors (Sass, Less, Stylus) and CSS modules. Version 0.1.2 is the latest stable release in the 0.x series. Compared to esbuild-plugin-postcss, it ships TypeScript types and fixes common issues. Peer dependencies include postcss 8.x and optional preprocessor libraries. The plugin auto-enables CSS modules for .module.css files and allows custom module configuration.

npm install esbuild-plugin-postcss2
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-POS
E
esbuild-plugin-postcss2
serializationjavascriptv0.1.2
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 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' } }) ] });
Debug
Known issues
breakingPlugin requires esbuild >= 0.8.0 (not specified in package.json but used internally)
fix
Ensure esbuild version is 0.8.0 or higher.
affects: >=0.1.0
gotchaDefault import via require is an object with .default property
fix
Use require('esbuild-plugin-postcss2').default() instead of calling require directly.
affects: >=0.1.0
gotchapostcss-modules is enabled by default, may cause unexpected behavior if not needed
fix
Set modules: false in options to disable CSS modules.
affects: >=0.1.0
deprecatedOriginal esbuild-plugin-postcss package is unmaintained; this fork is the recommended replacement
fix
Switch to esbuild-plugin-postcss2.
affects: 0.0.x
Errors
Common errors & fixes
TypeError: postCssPlugin is not a function
CommonJS require returns an object; you must call .default()
fix
const postCssPlugin = require('esbuild-plugin-postcss2').default;
Error: PostCSS plugin postcss-modules requires PostCSS 8
postcss-modules is incompatible with PostCSS 7
fix
Ensure postcss@8 is installed as a devDependency.
Error: Cannot find module 'sass'
Sass/SCSS files require sass to be installed
fix
npm install -D sass
Upgrade
Version history
0.1.2latest on npm
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
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-plugin-postcss2 — npm install esbuild-plugin-postcss2 · libregistry