Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webpack-strip-block

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-strip-block

Webpack plugin to strip blocks of code that's only intended for development purposes

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24K
increased by4.26%
Maintainers
1
Weekly downloads
 
Created
Source

Webpack Strip Block

Webpack loader to strip blocks of code marked by special comment tags

###Example:

In your client js source files:


var makeFoo(bar, baz) {
    // The following code will be stripped with our webpack loader
    /* develblock:start */
    if (bar instanceof Bar !== true) {
        throw new Error('makeFoo: bar param is required and must be instance of Bar');
    }
    /* develblock:end */

    // This code would remain
    return new Foo(bar, baz);
}

In your webpack config:

{
    module: {
        loaders: [
            { test: /\.js$/, loader: "webpack-strip-block" }
        ]
    }
};

It is also possible to overwrite the start and end variables with url-encoded string values:

{
    module: {
        loaders: [
            { test: /\.js$/, loader: "webpack-strip-block?start=DEV-START&end=DEV-END" }
        ]
    }
};

Webpack 2

{
  rules: [
    {
      test: /\.js$/,
      enforce: 'pre',
      exclude: /(node_modules|bower_components|\.spec\.js)/,
      use: [
        'webpack-strip-block?start=devcode:start&end=devcode:end'
      ]
    }
  ]
}

Keywords

FAQs

Package last updated on 21 Apr 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc