
Research
SAP CAP npm Packages Hit by Supply Chain Attack
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.
empty-module-loader
Advanced tools
A webpack loader that replaces module with empty function.
npm install --save-dev empty-module-loader
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /path-to-match-module/,
loader: 'empty-module-loader'
}
]
}
}
That is it! All the related codes should be removed in production.
This config is for demonstration only.
webpack.config.js
const path = require('path')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /debug/,
loader: require.resolve('empty-module-loader')
},
],
},
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
warnings: false,
mangle: false,
ie8: false,
output: {
preserve_line: true,
comments: true,
indent_level: 2,
},
},
}),
],
},
}
src/index.js
import debug from './debug'
console.log('normal code')
debug('booting %o', 3)
console.log('normal code')
src/debug.js
export default function debug (...args) {
console.log('debug:', ...args)
}
npm init -y
npm install webpack webpack-cli uglifyjs-webpack-plugin --save-dev
npx webpack --config webpack.config.js
/************************************************************************/
/******/([
/* 0 */
/***/function(module,__webpack_exports__,__webpack_require__){
"use strict"
;__webpack_require__.r(__webpack_exports__);// removed by empty-module-loader
// CONCATENATED MODULE: ./src/index.js
console.log("normal code"),
console.log("normal code")
/***/}
/******/]);
FAQs
A webpack loader that replaces module with empty function.
The npm package empty-module-loader receives a total of 35 weekly downloads. As such, empty-module-loader popularity was classified as not popular.
We found that empty-module-loader 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
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.