Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

babel-plugin-comments

It's a babel plugin for remove comments.

babel, babel-plugin

readme

babel-plugin-comments

Currently it's a babel plugin for remove comments.

Installation

To install babel-plugin-comments,use npm

npm install --save-dev babel-plugin-comments

or use yarn

yarn add -D babel-plugin-comments

options

  • remove (string) type specifies the type of comments you want to remove.

    Possible value:

     - none (default): nothing will be removed;
    
     - all: all comments will be removed;
    
     - line: commentline will be removed(such as: //example);
    
     - CommentLine : same as 'line';
    
     - block: commentblock will be removed(such as: /* example*/);
    
     - CommentBlock: same as 'block';
    

    Example

babel method:

  babel.transform(code, { plugins: [[plugin, { remove: 'all' }]] })

or babel.config.js:

  plugins: [
    [
      'comments',
      {
        remove: 'line',
      }
    ],
  ]