esbuild-plugin-replace-regex

0.0.2 • Public • Published

esbuild-plugin-replace-regex

npm

Simple esbuild plugin for replacing file content while bundling.

Installation

npm i esbuild-plugin-replace-regex --save-dev

Usage

const replacePlugin = require('esbuild-plugin-replace-regex');

...
plugins: [
  replacePlugin({
    filter: /myfile/,
    patterns: [
      ['VERSION', 'v7.7.7'],
      [/myfunc\((.+?)\)/g, (m, arg) => `replaced(123, ${arg})`],
    ]
  })
]
...

Options

{
  filter = /.*/,
  loader = "tsx",
  encoding = "utf-8",
  patterns = []
}

/esbuild-plugin-replace-regex/

    Package Sidebar

    Install

    npm i esbuild-plugin-replace-regex

    Weekly Downloads

    595

    Version

    0.0.2

    License

    UNLICENSED

    Unpacked Size

    2.6 kB

    Total Files

    3

    Last publish

    Collaborators

    • fakundo