Remove underscore.js
Closed this issue · 1 comments
72% of the size of EJSON is underscore yet only a small portion of it is used.
By removing the underscore requirement and replacing it with only the specific methods we need from lodash
, we can reduce the size of EJSON by more than half.
https://bundlephobia.com/result?p=ejson@2.1.2
This won't affect the weight for users that are already using underscore
very much and it would remove loading all of underscore
for lodash
users. And if you don't use either, it reduces the weight to a minimum.
For example, instead of
import _ from 'underscore'
_.has(object, path)
We can do
import has from 'lodash/has'
has(object, path)
I can make a PR if you are in agreement.
It seems the dependency from underscore was removed in meteor/meteor@c6bddb3#diff-91868601b1609aa65a70a2ee9d2ec610
There is a script to pull the required js files from upstream (npm run update
) but some work is also needed to remove underscore from