Socket
Socket
Sign inDemoInstall

babel-plugin-recharts

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-recharts

Modular Recharts builds without the hassle.


Version published
Weekly downloads
18K
increased by8.93%
Maintainers
3
Weekly downloads
 
Created
Source

babel-plugin-recharts

A babel plugin help you import less Recharts modules.

npm version build status npm downloads

install

$ npm i -D babel-plugin-recharts

Example

The plugin automatically compiles recharts import, like this:

import { Line, Area, Pie, Treemap, Cell } from 'recharts';

babel plugin will be parsed into:

"use strict";

require("recharts/lib/polyfill.js");

var _Line = _interopRequireDefault(require("recharts/lib/cartesian/Line.js"));

var _Area = _interopRequireDefault(require("recharts/lib/cartesian/Area.js"));

var _Treemap = _interopRequireDefault(require("recharts/lib/chart/Treemap.js"));

var _Pie = _interopRequireDefault(require("recharts/lib/polar/Pie.js"));

var _Cell = _interopRequireDefault(require("recharts/lib/component/Cell.js"));

var _recharts = _interopRequireDefault(require("recharts"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

Hence you end up loading less modules.

Usage

You can choose to either edit your custom Babel configuration or your Webpack configuration. Both options work..

.babelrc

{
  "plugins": ["recharts"]
  ...
}

webpack.config.js

'module': {
  'loaders': [{
    'loader': 'babel-loader',
    'test': /\.js$/,
    'exclude': /node_modules/,
    'query': {
      'plugins': ['recharts'],
      ...
    }
  }]
}

Limitations

  • You must use ES2015 imports to load recharts

License

MIT

Copyright (c) 2015-2021 Recharts Group

Keywords

FAQs

Package last updated on 21 Mar 2021

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