esbuild-plugin-define
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

esbuild-plugin-define

Build Status

Install

npm install esbuild-plugin-define -D

Usage

Add the plugin to your esbuild plugins.

Example esbuild.config.cjs file:

const { definePlugin } = require('esbuild-plugin-define');

module.exports = () => {
  const config = {
    bundle: true,
    sourcemap: true,
    platform: 'node',
    target: 'es2022',
    format: 'esm',
    outputFileExtension: '.mjs',
    define: {},
    concurrency: 4,
    watch: {
      pattern: ['./src/**'],
      ignore: ['dist', 'node_modules'],
    },
    plugins: [
      definePlugin({
        process: {
          env: {
            BUILD_TIMESTAMP: new Date().toISOString(),
          },
        },
      }),
    ],
  };

  return config;
};

Dependents (1)

Package Sidebar

Install

npm i esbuild-plugin-define

Weekly Downloads

2,250

Version

0.5.0

License

MIT

Unpacked Size

7.96 kB

Total Files

14

Last publish

Collaborators

  • webdeveric