Skip to main content

Built and signed on GitHub Actions

An esbuild plugin for Deno.env

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 months ago (1.2.0)
function denoEnvPlugin
denoEnvPlugin(values?: Record<string, string>): Plugin

Create plugin to inject Deno.env mock to global.

Examples

Example 1

import { denoEnvPlugin } from "@miyauci/esbuild-deno-env";
import { build } from "esbuild";

declare const env: { ENDPOINT: string };

await build({
 stdin: {
   contents: `Deno.env.get("ENDPOINT");`,
 },
 plugins: [denoEnvPlugin(env)],
 bundle: true,
 format: "esm",
});

Parameters

optional
values: Record<string, string>

Environment variables at invocation.

Return Type

An esbuild plugin.

Add Package

deno add jsr:@miyauci/esbuild-deno-env

Import symbol

import { denoEnvPlugin } from "@miyauci/esbuild-deno-env";

---- OR ----

Import directly with a jsr specifier

import { denoEnvPlugin } from "jsr:@miyauci/esbuild-deno-env";

Add Package

npx jsr add @miyauci/esbuild-deno-env

Import symbol

import { denoEnvPlugin } from "@miyauci/esbuild-deno-env";

Add Package

yarn dlx jsr add @miyauci/esbuild-deno-env

Import symbol

import { denoEnvPlugin } from "@miyauci/esbuild-deno-env";

Add Package

pnpm dlx jsr add @miyauci/esbuild-deno-env

Import symbol

import { denoEnvPlugin } from "@miyauci/esbuild-deno-env";

Add Package

bunx jsr add @miyauci/esbuild-deno-env

Import symbol

import { denoEnvPlugin } from "@miyauci/esbuild-deno-env";