How to Import a Single Lodash Function?

后端 未结 7 1738
無奈伤痛
無奈伤痛 2020-11-30 19:42

Using webpack, I\'m trying to import isEqual since lodash seems to be importing everything. I\'ve tried doing the following with no success:

imp         


        
相关标签:
7条回答
  • 2020-11-30 20:17

    import { isEqual } from 'lodash-es'; is importing the entire library. I am using Rollup which should do tree shaking by default.

    Whenever I've written my own modules, this named import syntax works and Rollup successfully tree shakes, so I'm a bit confused as to why it won't work with Lodash.

    0 讨论(0)
提交回复
热议问题