Registry / web-framework / esbuild-postcss-plugin

esbuild-postcss-plugin

JSON →
library0.0.7jsnpmunverified

An ESBuild plugin that integrates PostCSS processing with support for CSS modules. Current version 0.0.7 is stable but infrequently updated. It allows you to apply PostCSS plugins (e.g., Autoprefixer) and CSS modules within the ESBuild bundler, with options for caching, file filtering, and module configuration. Unlike alternatives (e.g., esbuild-plugin-postcss2), this plugin explicitly supports CSS modules and provides a simple API. However, it has not been updated for over three years and may lack compatibility with newer PostCSS or ESBuild versions.

web-framework
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

ESM default import works for TypeScript and modern JavaScript.

import postCSSPlugin from 'esbuild-postcss-plugin'

The package exports a function as default; named import is incorrect.

import postCSSPlugin from 'esbuild-postcss-plugin'

Type-only import for TypeScript users when defining options object.

import type { PostCSSPluginOptions } from 'esbuild-postcss-plugin'

Shows how to configure the plugin with PostCSS plugin (Autoprefixer) and custom CSS modules naming pattern.

import * as esbuild from 'esbuild' import postCSSPlugin from 'esbuild-postcss-plugin' await esbuild.build({ entryPoints: ['src/index.js'], bundle: true, outfile: 'dist/bundle.js', plugins: [postCSSPlugin({ plugins: [require('autoprefixer')], modulesOptions: { generateScopedName: '[name]__[local]___[hash:base64:5]' } })] })
Debug
Known footguns
gotchaCaching may cause incorrect results if PostCSS plugins depend on external files (e.g., Tailwind CSS).
gotchaThe `resolve`, `Loader`, and `root` options in `modulesOptions` are ignored.
gotchaThe plugin may not work correctly with ESBuild versions newer than 0.12.x due to API changes.
gotchaDefault import fails with TypeScript if `esModuleInterop` is not enabled.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
gptbot
3
ahrefsbot
3
claudebot
3
bingbot
1
Resources