{"id":25360,"library":"esbuild-plugin-jscc","title":"esbuild-plugin-jscc","description":"JSCC plugin for esbuild that enables conditional compilation using JSCC directives (e.g., //#if, //#ifdef, //#endif) in JavaScript and TypeScript bundles. Version 1.1.2, actively maintained. Integrates seamlessly with esbuild's build pipeline, allowing you to include or exclude code blocks at build time based on predefined or environment variables. Useful for toggling debug code, feature flags, or platform-specific snippets without runtime overhead. Unlike alternatives like preprocessor or esbuild-plugin-condition, it leverages JSCC syntax familiar to developers using JSCC with other bundlers.","status":"active","version":"1.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/nesvet/esbuild-plugin-jscc","tags":["javascript","esbuild","jscc","plugin"],"install":[{"cmd":"npm install esbuild-plugin-jscc","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-jscc","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-jscc","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: plugin requires esbuild's Plugin API","package":"esbuild","optional":false}],"imports":[{"note":"Package exports a single default function. ESM only; CommonJS require is not supported.","wrong":"const jscc = require('esbuild-plugin-jscc')","symbol":"default","correct":"import jscc from 'esbuild-plugin-jscc'"},{"note":"Default export, not named. Do not use destructuring.","wrong":"import { jscc } from 'esbuild-plugin-jscc'","symbol":"jscc","correct":"import jscc from 'esbuild-plugin-jscc'"},{"note":"TypeScript users can import the type for full options. Available in v1.1+.","wrong":"","symbol":"JsccOptions","correct":"import type { JsccOptions } from 'esbuild-plugin-jscc'"}],"quickstart":{"code":"import esbuild from 'esbuild';\nimport jscc from 'esbuild-plugin-jscc';\n\n// Example with conditional logs\n// In your source code:\n// //#if DEBUG\n// console.log('Debug mode');\n// //#endif\n\nawait esbuild.build({\n  entryPoints: ['src/index.ts'],\n  bundle: true,\n  outfile: 'dist/index.js',\n  plugins: [jscc({ values: { DEBUG: true } })],\n});","lang":"typescript","description":"Sets up esbuild with the JSCC plugin to conditionally include debug code when DEBUG is true."},"warnings":[{"fix":"Ensure all entry points are included in the build and not marked as external if you need JSCC processing.","message":"Plugin only processes files processed by esbuild. Files not bundled (e.g., external) will not be transformed.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update import from 'const jscc = require(\"esbuild-plugin-jscc\")' to 'import jscc from \"esbuild-plugin-jscc\"'.","message":"Version 1.0.0 changed the plugin API from a factory function to a default export.","severity":"breaking","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use default import: import jscc from 'esbuild-plugin-jscc'","cause":"Importing the plugin incorrectly (e.g., using named import instead of default).","error":"Error: The plugin \"jscc\" must be an object with a \"name\" and \"setup\" function."},{"fix":"Run npm install esbuild-plugin-jscc --save-dev","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'esbuild-plugin-jscc'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}