react-throttle icon indicating copy to clipboard operation
react-throttle copied to clipboard

Use `babel-plugin-lodash`

Open kenany opened this issue 8 years ago • 2 comments

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

kenany avatar May 09 '17 20:05 kenany

Rebased.

kenany avatar Nov 17 '17 15:11 kenany

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

kenany avatar Nov 17 '17 15:11 kenany