Wondering what’s next for npm?Check out our public roadmap! »

    strip-debug

    6.0.0 • Public • Published

    strip-debug

    Strip console, alert, and debugger statements from JavaScript code

    Useful for making sure you didn't leave any logging in production code.

    Usage

    $ npm install @babel/core strip-debug
    

    Usage

    import {transformSync} from '@babel/core';
    import stripDebug from 'strip-debug';
    
    transformSync('function foo(){console.log("foo");alert("foo");debugger;}', {
    	plugins: [stripDebug]
    }).code;
    //=> 'function foo() { void 0;void 0; }'

    To prevent any side-effects, console.*/alert* is replaced with void 0 instead of being stripped.

    If you shadow the console global with your own local variable, it will still be removed.

    Related

    Install

    npm i strip-debug

    DownloadsWeekly Downloads

    9,742

    Version

    6.0.0

    License

    MIT

    Unpacked Size

    4.15 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar