1.4.2 • Published 8 months ago

@dotenv-run/esbuild v1.4.2

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

@dotenv-run/esbuild

  • ✅ Load environment variables from the command line API_BASE=/v1/ node esbuild.mjs
  • ✅ Load environment variables from .env files
  • ✅ Expand environment variables API_URL=$API_BASE/users
  • ✅ Define environment variables for a specific environment (e.g. .env.production)
  • ✅ Load priorities of .env.* files (e.g. .env.production > .env)
  • ✅ Hierarchical cascading configuration in monorepo projects (Nx, Turbo, etc.) apps/next-app/.env > apps/.env > .env

Install

npm add @dotenv-run/esbuild --save-dev

Usage

Using define (recommended)

import { build } from "esbuild";
import { env } from "@dotenv-run/esbuild";

const { full } = env({
  prefix: "MY_",
  verbose: false,
  files: [".env"],
});

const results = await build({
  bundle: true,
  write: false,
  entryPoints: [`test/app.js`],
  define: full,
});

Using esbuild plugin

import { build } from "esbuild";
import { dotenvRun } from "@dotenv-run/esbuild";

await build({
  write: false,
  bundle: true,
  entryPoints: [`test/app.js`],
  plugins: [
    dotenvRun({
      verbose: true,
      root: "../../",
      prefix: "^API",
    }),
  ],
});
1.4.2

8 months ago

1.4.0

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago