Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

I don't suppose there's a way to simply specify an array of methods you want? #76

Closed
faceyspacey opened this issue Oct 30, 2016 · 9 comments

Comments

@faceyspacey
Copy link

faceyspacey commented Oct 30, 2016

Also, what about the babel plugin producing that list of methods and somehow passing it to the webpack plugin so that the lodash build is as tight as possible?

And if that's not possible, perhaps just leaving it on your file system for manually pasting it as a param to the webpack plugin, if that's the best we can do.

@jdalton
Copy link
Member

jdalton commented Oct 30, 2016

Hi @faceyspacey!

At that point you're probably better off manually cherry-picking.

@jdalton jdalton closed this as completed Oct 30, 2016
@faceyspacey
Copy link
Author

faceyspacey commented Oct 30, 2016

I am and all the package I use are (i.e. importing via full path, eg: import find from 'lodash/find'). Until I used this package I could not reduce lodash's size from 135kb. Now I'm at 70kb, but still with a bunch of unused functions. Here's my build size visualized:

https://www.dropbox.com/s/cik6rw9kmpexynr/Screenshot%202016-10-30%2016.54.44.png?dl=0

Is it that one of the packages I use imports via dot syntax? import find from 'lodash.find'? Or is that the same as importing by full paths?

@jdalton
Copy link
Member

jdalton commented Oct 31, 2016

This plugin doesn't work with the per method packages like lodash.find.
For a sanity check, the full-build of Lodash is ~23kb minified+gzipped.

@faceyspacey
Copy link
Author

I know, I'm just trying to get it to 1kb since only like 5 methods are used. Going from a 150kb build (minified and gzipped) to 128kb build is substantial. ..Glad to know the the per method packages operate differently/separately.

@jdalton
Copy link
Member

jdalton commented Oct 31, 2016

What are the 5 methods?

@faceyspacey
Copy link
Author

memoize, debounce, find, findIndex, isEqual, isString, though webpack visualizer is picking up a few internal methods like _baseMergeDeep.

here's what i'm using to visualize the size of imports:
https://chrisbateman.github.io/webpack-visualizer

@jdalton
Copy link
Member

jdalton commented Oct 31, 2016

That build is 2.75 kB minified+gzipped.
Created with a a combo of babel-plugin-lodash and lodash-webpack-plugin.

@faceyspacey
Copy link
Author

do you know why it's showing as so much more (yes, I know it's pre-minification/gzipping):

https://www.dropbox.com/s/a4stwjrg4idxaiv/Screenshot%202016-10-30%2022.23.17.png?dl=0

The green bar without any orange child nodes, to me, has meant shipped but unused functions. Is it lodash core possibly? Does 70kb make sense for just that pre-minification/gzipping?

@jdalton
Copy link
Member

jdalton commented Oct 31, 2016

If I had to guess it's probably showing the cumulative total of the individual uniminified modules before the lodash-webpack-plugin is applied.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants