You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

esbuild-plugin-replace-regex

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-replace-regex

Simple esbuild plugin for replacing file content while bundling

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
623
-0.64%
Maintainers
1
Weekly downloads
 
Created
Source

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 = []
}

Keywords

esbuild

FAQs

Package last updated on 12 Aug 2022

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