Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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 288 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.