
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
webpack-plugin-replace
Advanced tools
Replace content while bundling.
$ npm install --save-dev webpack-plugin-replace
// webpack.config.js
const ReplacePlugin = require('webpack-plugin-replace');
module.exports = {
// ...
plugins: [
new ReplacePlugin({
exclude: [
'foo.js',
/node_modules/,
filepath => filepath.includes('ignore')
],
patterns: [{
regex: /throw\s+(new\s+)?(Type|Reference)?Error\s*\(/g,
value: 'return;('
}],
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
'FOO_BAR': '"hello world"',
'DEV_MODE': false,
}
})
]
};
Type: Array|String|Function|RegExp
Default: false
If multiple conditions are provided, matching any condition will exclude the filepath, which prevents any alterations.
Note: By default, nothing is excluded!
Type: Array|String|Function|RegExp
Default: true
If multiple conditions are provided, matching any condition will include & scan the filepath for eligible replacements.
Note: By default, all filepaths are included!
Type: Array
Default: []
An array of RegExp
pattern definitions. Each definition is an object with regex <RegExp>
and value <String|Function>
keys. If value
is a function, it takes the same arguments as String.prototype.relace
.
Type: Object
Default: {}
An object whose keys are strings
that should be replaced and whose values are strings
the replacements.
If desired, you may forgo the values
key & declare your key:value
pairs directly to the main configuration. For example:
{
exclude: /node_modules/,
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
}
}
// is the same as:
{
exclude: /node_modules/,
'process.env.NODE_ENV': JSON.stringify('production'),
}
MIT © Luke Edwards
FAQs
Replace content while bundling.
We found that webpack-plugin-replace demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.