ESBuild plugin (v1.1.1, maintained) that loads environment variables using dotenv and makes them available via process.env at build time. Key differentiators: automatically sets NODE_ENV based on minify flag, provides PROD/DEV boolean constants, supports custom key prefix (default ESB_), and allows overriding production detection. Ships TypeScript types. Alternative to @jvdx/esbuild-plugin-env or manual define replacements.
npm install esbuild-plugin-envVerified import paths — ran on the pinned version, not inferred.
Shows basic usage of esbuild-plugin-env: import, call env() in plugins array, and access variables from .env via process.env.
Use `startKey` instead of `startkey` in the options object.
Ensure your .env keys start with `ESB_` (or the configured startKey).
Explicitly set `isProd: true` in options if you want production behavior without minification.
Use dotenv's path option by calling `require('dotenv').config({ path: '/custom/path' })` before running esbuild.Run `npm install esbuild-plugin-env --save-dev` or check that the package is listed in devDependencies.
Use `import env from 'esbuild-plugin-env'` (default import) instead of `import { env } from 'esbuild-plugin-env'`.Create a .env file in the root of your project or use dotenv's config to specify a path before building.