v1.0.0
An esbuild plugin that exports the current environment as a module
Repository
Current version released
3 years ago
Versions
esbuild-plugin-env
This is an esbuild plugin that exports the current environment as a module, allowing you to embed environment variables in your build.
Usage
Here’s an example of usage in Deno. Let’s say you have a module secret.js
that exports a secret:
export {SECRET as default} from 'env'
You can bundle it like this:
Deno.env.set('SECRET', '********')
await build({
bundle: true,
format: 'esm',
entryPoints: ['secret.js'],
plugins: [env]
})
This will result in this code:
var SECRET = "********";
export {
SECRET
};