JSPM

gatsby-plugin-remove-console

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9439
  • Score
    100M100P100Q139717F
  • License MIT

Removes console calls from Gatsby production builds.

Package Exports

  • gatsby-plugin-remove-console

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gatsby-plugin-remove-console) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gatsby-plugin-remove-console

NPM JavaScript Style Guide

A plugin that adds support to remove all console.* calls from Gatsby's production builds using babel-plugin-transform-remove-console.

Example

In

console.log('foo');
console.error('bar');

Out

Getting started

Install the plugin

npm install gatsby-plugin-remove-console && npm install babel-plugin-transform-remove-console --save-dev

or

yarn add gatsby-plugin-remove-console && yarn add babel-plugin-transform-remove-console --dev

Usage

Specify the plugin in your gatsby-config.js. Here's an example:

// without options
module.exports = {
  plugins: [
    'gatsby-plugin-remove-console'
  ],
};
// with options
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-remove-console',
      options: {
        exclude: ['error', 'warn'], // <- will be removed all console calls except these
      }
    }
  ]
};

Options

exclude - An array of console methods to exclude from removal.

License

MIT, see LICENSE.md for details.

Changelog

See CHANGELOG.md for details.