babel-plugin-recharts
A babel plugin help you import less Recharts modules.
install
$ npm i -D babel-plugin-recharts
Example
from
import { Line, Pie, Treemap } from 'recharts';
to
import Treemap from 'recharts/chart/Treemap';
import Pie from 'recharts/polar/Pie';
import Line from 'recharts/cartesian/Line';
Usage
.babelrc
{
"plugins": ["recharts"],
"presets": ["es2015"]
}
webpack.config.js
'module': {
'loaders': [{
'loader': 'babel-loader',
'test': /\.js$/,
'exclude': /node_modules/,
'query': {
'plugins': ['recharts'],
'presets': ['es2015']
}
}]
}
Limitations
- You must use ES2015 imports to load recharts
License
MIT
Copyright (c) 2015-2016 Recharts Group