
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
webpack-plugin-create-multiple-bundle-from-string-replace
Advanced tools
Create some bundles for multi-target environment which from string replace options
English | 简体中文
Create some bundles for multi-target environment which from string replace options
-- by keruyun.com
npm i -D webpack-plugin-create-multiple-bundle-from-string-replace
const MultipleBundle = require('webpack-plugin-create-multiple-bundle-from-string-replace');
const config = {
plugins: [
new MultipleBundle({ // require
targetOne: [
['HOST_API', 'HOST_CDN'], // find , may contain Regular Expressions, /HOST_API/
['//targetOne.you-company.com/api', '//targetOne.you-company.com/cdn'], // replace
],
targetTwo: [
['HOST_API', 'HOST_CDN'],
['//targetTwo.you-company.com/api', '//targetTwo.you-company.com/cdn'],
],
},
{ // optional
sourcePath: 'xxx/xxx', // default is undefined then used webpack.config.output.path
distPath: 'xxx/xxx', // default is undefined then used webpack.config.output.path/multiple-bundle-from-string-replace
replaceExtname: ['txt'], // default is ['html', 'htm', 'css', 'js', 'jsx','json', 'md'] , merge with default
}),
],
};
Then get two bundles directory (targetOne, targetTwo) in which all text type of files are replaced by above options:
${webpack.config.output.path}/multiple-bundle-from-string-replace/(targetOne|targetTwo)
dist
├── ...originOutput
│
└── multiple-bundle-from-string-replace
├── targetOne
│ ├── ...replacedOutput
│ └── ...replacedOutput
└── targetTwo
├── ...replacedOutput
└── ...replacedOutput
const MultipleBundle = require('webpack-plugin-create-multiple-bundle-from-string-replace');
const config = {
plugins: [
new MultipleBundle([
['HOST_API', 'HOST_CDN'], // find , may contain Regular Expressions, /HOST_API/
['//targetOne.you-company.com/api', '//targetOne.you-company.com/cdn'], // replace
]),
],
};
Then get origin bundles directory which all text type of files are replaced by above options:
${webpack.config.output.path}/
dist
└── ...replacedOutput
'HOST_API' => '//targetOne.you-company.com/api'
'HOST_CDN' => '//targetOne.you-company.com/cdn'
Used replace-once.
replaceOnce(fileContent, find, replace, 'g');
var str = 'abc abcd a ab';
var find = ['abcd', 'abc', 'ab', 'a'];
var replace = ['a', 'ab', 'abc', 'abcd'];
replaceOnce(str, find, replace, 'g');
//=> 'ab a abcd abc'
thanks: https://github.com/kodie/replace-once
MIT. See the license.md file for more info.
FAQs
Create some bundles for multi-target environment which from string replace options
The npm package webpack-plugin-create-multiple-bundle-from-string-replace receives a total of 0 weekly downloads. As such, webpack-plugin-create-multiple-bundle-from-string-replace popularity was classified as not popular.
We found that webpack-plugin-create-multiple-bundle-from-string-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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.