{"id":25452,"library":"esbuild-style-plugin-v2","title":"esbuild-style-plugin-v2","description":"An esbuild plugin for processing CSS, SASS, LESS, and STYLUS files. Current version 1.6.5. Supports CSS Modules via PostCSS, dynamic preprocessor imports (no bundled dependencies), and SSR-friendly extraction. Can read postcss.config.js for configuration. Written in TypeScript with dual CJS/ESM builds. Fork of esbuild-style-plugin with active maintenance.","status":"active","version":"1.6.5","language":"javascript","source_language":"en","source_url":"https://github.com/nullbio/esbuild-style-plugin-v2","tags":["javascript","typescript"],"install":[{"cmd":"npm install esbuild-style-plugin-v2","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-style-plugin-v2","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-style-plugin-v2","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for CSS Modules and PostCSS plugin support","package":"postcss","optional":true},{"reason":"Required for SASS/SCSS preprocessing","package":"sass","optional":true},{"reason":"Required for LESS preprocessing","package":"less","optional":true},{"reason":"Required for STYLUS preprocessing","package":"stylus","optional":true}],"imports":[{"note":"Package supports both ESM default import and CJS require. Default export is the plugin function.","wrong":"const stylePlugin = require('esbuild-style-plugin-v2')","symbol":"stylePlugin","correct":"import stylePlugin from 'esbuild-style-plugin-v2'"},{"note":"TypeScript type for plugin options. Only available as type import.","wrong":"","symbol":"PluginOptions","correct":"import type { PluginOptions } from 'esbuild-style-plugin-v2'"},{"note":"The plugin function is the default export, not a named export.","wrong":"import { stylePlugin } from 'esbuild-style-plugin-v2'","symbol":"default export","correct":"import stylePlugin from 'esbuild-style-plugin-v2'"}],"quickstart":{"code":"import esbuild from 'esbuild';\nimport stylePlugin from 'esbuild-style-plugin-v2';\n\nawait esbuild.build({\n  entryPoints: ['src/index.ts'],\n  outfile: 'dist/bundle.js',\n  bundle: true,\n  plugins: [\n    stylePlugin({\n      cssModulesMatch: /\\.module\\.(css|sass|scss|less|styl)$/,\n      renderOptions: {\n        sassOptions: {\n          sourceMap: true\n        }\n      },\n      postcss: {\n        plugins: []\n      }\n    })\n  ]\n});","lang":"typescript","description":"Basic esbuild build configuration with SASS support and CSS Modules enabled."},"warnings":[{"fix":"Do not include cssnano in the postcss plugins array. Use esbuild's built-in minify option.","message":"PostCSS plugins like cssnano are not supported; use esbuild's minification instead.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use esbuild-style-plugin-v2 instead of esbuild-style-plugin.","message":"The plugin is a fork of esbuild-style-plugin which is no longer maintained.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Install the required preprocessor: npm i -D sass (or less, stylus)","message":"Preprocessors (sass, less, stylus) are not installed by default; user must install them separately.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add 'esbuild-style-plugin-v2' to the 'types' array in tsconfig.json or add a custom .d.ts declaration.","message":"When using TypeScript, importing .module.scss files requires a type declaration.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install sass: npm i -D sass","cause":"SASS preprocessor not installed; it's not bundled with the plugin.","error":"Error: Cannot find module 'sass'"},{"fix":"Remove cssnano from postcss.plugins and use esbuild's minify option instead.","cause":"Using cssnano as a PostCSS plugin, which is explicitly disallowed.","error":"Error: [esbuild-style-plugin-v2] You can't use cssnano, it's not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}