🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

webpack-strip-function

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-strip-function

Webpack plugin to strip any function call that you specified that are only intended for development purposes

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

webpack-strip-function

Webpack plugin to strip any function call that you specified that are only intended for development purposes

Install

NPM

npm i --save-dev webpack-strip-assert

Yarn

yarn add -D webpack-strip-assert

Example

// webpack.config.js

const path = require("path");

module.exports = env => {
  return {
    entry: "./index.js",
    output: {
      path: path.resolve(__dirname, "dist"),
      filename: "index.js"
    },
    module: {
      rules: [
        {
          test: /\.js$/,
          loader: "webpack-strip-assert",
          options: {
            funcCall: "assert"
          }
        }
      ]
    }
  };
};
// index.js

console.log("Hello webpack-strip-function");

function add(a, b) {
  return a + b;
}
assert("Add result should be 2", add(1, 1));

Then run webpack --mode production in bash, you will get bellow ☟

// dist/index.js

...
console.log("Hello webpack-strip-function"); // assert function call be removed!🙆 ‍

TODO

  • Support remove multip function call

LICENSE

MIT

AUTHOR

Aiello.Chan@gmail.com

Keywords

webpack

FAQs

Package last updated on 23 Aug 2019

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