How to Import a Single Lodash Function?

后端 未结 7 1772
無奈伤痛
無奈伤痛 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.

提交回复
热议问题