react-throttle
react-throttle copied to clipboard
Use `babel-plugin-lodash`
This patch introduces the babel-plugin-lodash plugin in order to rewrite the lodash imports from, say:
import _ from 'lodash';
export default function(func) {
return _.isFunction(func) && func.name === 'debounced';
}
to:
import isFunction from 'lodash/isFunction';
export default function(func) {
return isFunction(func) && func.name === 'debounced';
}
This helps to reduce bundle size. Bundle size before patch:
$ browserify lib | gzip -9 | wc -c | pretty-bytes
132 kB
Bundle size with this patch:
$ browserify lib | gzip -9 | wc -c | pretty-bytes
62.9 kB
Fixes https://github.com/gmcquistin/react-throttle/issues/5
Rebased.
Without patch:
$ browserify lib | gzip -9 | wc -c | pretty-bytes
117 kB
With patch:
$ browserify lib | gzip -9 | wc -c | pretty-bytes
48.1 kB