esbuild-plugin-ifdef
JSON →esbuild plugin for conditional compilation using `//#ifdef` comments in JavaScript and TypeScript files. Version 1.0.1 is the latest stable release. It allows developers to include or exclude code blocks based on environment variables before esbuild's tree-shaking phase. Unlike traditional `if (true)` patterns that break function scoping, this plugin removes dead code at the comment level, preserving correct scoping. It filters `process.env` prefixes automatically and supports negation with `!`. The plugin excludes `node_modules` by default for performance and security. Alternative to `esbuild-plugin-conditional` or manual define-based checks, but with a simpler preprocessor-style comment syntax.
Traffic · last 30 days ↓67% vs prev 7d
top countries 🇨🇦 Canada · 🇺🇸 United States · 🇫🇷 France · PT