{"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,"search_vec":"'1.6.5':19 'activ':55 'build':47 'bundl':29 'cjs/esm':46 'configur':40 'css':11,21 'current':17 'depend':30 'dual':45 'dynam':25 'esbuild':2,7,51 'esbuild-style-plugin':50 'esbuild-style-plugin-v2':1 'extract':35 'file':16 'fork':48 'friend':34 'import':27 'javascript':57 'less':13 'mainten':56 'modul':22 'plugin':4,8,53 'postcss':24 'postcss.config.js':38 'preprocessor':26 'process':10 'read':37 'sass':12 'ssr':33 'ssr-friend':32 'style':3,52 'stylus':15 'support':20 'typescript':43,58 'v2':5 'version':18 'via':23 'written':41","created_at":"2026-05-01T13:44:50.356416+00:00","updated_at":"2026-05-01T13:44:50.356416+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/nullbio/esbuild-style-plugin-v2","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/esbuild-style-plugin-v2","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}