esbuild-plugin-replace-regex
v0.0.2
Published
Simple esbuild plugin for replacing file content while bundling
Downloads
2,431
Readme
esbuild-plugin-replace-regex
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 = []
}