New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

remove-function-loader

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

remove-function-loader

remove specified functions calls in your source files during your webpack build

unpublished
latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

remove-function-loader

The Problem

We can run ifdef as a webpack loader, but it requires us to write additional code to parse. What if we have debugging, or development functions/methods being called that we simply want removed in production? Or what if we have method calls we want to omit when A/B testing new features?

The Solution

remove-function-loader reads your specficied files and removes function called (not definitions) from the file during a webpack build. It retains the function in the source code but the output from webpack has absolutely no calls to the specified functions.

Install

npm install --save-dev remove-function-loader

Setup

note: use Babel before running this loader

module: {
   rules: [
   {
     test: /\.js?$/, // Check for all js fi
     exclude: /(node_modules|bower_components)
     use: {
       loader: path.resolve('./src/loader.js'),
       options: {
         functions: ['hello', 'ttt.hello'],
         removeDefinitions: false
       }
     }
   }, 
   {
     test: /\.js?$/, // Check for all js files
     exclude: /(node_modules|bower_components)/,
     use: [{
       loader: 'babel-loader',
       options: {
       presets: ['env']
      }
     }]
   }]
  }
},

To Do:

  • Add support for removing function definitions
  • Add more examples

FAQs

Package last updated on 21 Feb 2018

Did you know?

Socket

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.

Install

Related posts