New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-plugin-environment

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-environment

esbuild plugin to define process.env variables

0.4.0
latest
Source
npm
Version published
Weekly downloads
963
0.21%
Maintainers
1
Weekly downloads
 
Created
Source

esbuild-plugin-environment

Build Status

Install

npm install esbuild-plugin-environment -D

Usage

Add the plugin to your esbuild plugins.

Example esbuild.config.cjs file:

const { environmentPlugin } = require('esbuild-plugin-environment');

module.exports = () => {
  const config = {
    bundle: true,
    sourcemap: true,
    platform: 'node',
    target: 'es2022',
    format: 'esm',
    outputFileExtension: '.mjs',
    environment: {},
    concurrency: 4,
    watch: {
      pattern: ['./src/**'],
      ignore: ['dist', 'node_modules'],
    },
    plugins: [
      // process.env key => default value
      environmentPlugin({
        BUILD_TIMESTAMP: new Date().toISOString(),
      }),
      // Array of process.env keys
      environmentPlugin(['PWD', 'npm_package_version']),
    ],
  };

  return config;
};

Keywords

esbuild

FAQs

Package last updated on 13 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts