How to require lodash/fp

Has anyone figured out a way to import lodash/fp (the functional variant of lodash)?

Both of these ways don’t seem to work.

_ = require('lodash/fp')
_ = require('')

That took some sleuthing due to idiosyncrasies in how lodash publishes, but here you go:


Thanks Mike! You are the best!

1 Like

Should I use this approach to require individual functions? This doesn’t seem to work:

I also tried require('lodash/uniq').

you could do this

uniq = require('lodash.uniq').catch(() => window.uniq)

or use skypack to load it

uniq = (await import("")).default
1 Like