Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
safe-umd-webpack-plugin
Advanced tools
Webpack plugin to handle optional dependency safely when using libraryTarget: umd
Webpack plugin to handle optional dependencies safely when using libraryTarget: umd
.
When using umd
as a libraryTarget with config like :
module.exports = {
entry: './src/index.js',
output: {
library: ['my', 'module'],
libraryTarget: 'umd',
filename: 'bundle.js'
},
externals: {
'my-ext-module': {
commonjs: 'my-ext-module',
commonjs2: 'my-ext-module',
amd: 'my-ext-module',
root: ['my', 'ext', 'module']
}
}
};
You can't use optional dependencies for a root (namespace) because of the generated code like :
root["my"] = root["my"] || {}, root["my"]["module"] = factory(root["my"]["ext"]["module"]);
This plugin replace code above to safely access the namespace with code like :
root["my"] = root["my"] || {}, root["my"]["module"] = factory(root["my"] && root["my"]["ext"] && root["my"]["ext"]["module"]);
npm install safe-umd-webpack-plugin --save-dev
// webpack.config.js
var SafeUmdPlugin = require('safe-umd-webpack-plugin');
// ...
module.exports = {
// ...
plugins: [
//...
new SafeUmdPlugin()
]
}
FAQs
Webpack plugin to handle optional dependency safely when using libraryTarget: umd
The npm package safe-umd-webpack-plugin receives a total of 596 weekly downloads. As such, safe-umd-webpack-plugin popularity was classified as not popular.
We found that safe-umd-webpack-plugin 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.