Correct way to import lodash

后端 未结 5 1176
梦谈多话
梦谈多话 2020-12-04 07:10

I had a pull request feedback below, just wondering which way is the correct way to import lodash?

You\'d better do import has from \'lodash/has\'.. F

5条回答
  •  醉梦人生
    2020-12-04 07:40

    If you are using babel, you should check out babel-plugin-lodash, it will cherry-pick the parts of lodash you are using for you, less hassle and a smaller bundle.

    It has a few limitations:

    • You must use ES2015 imports to load Lodash
    • Babel < 6 & Node.js < 4 aren’t supported
    • Chain sequences aren’t supported. See this blog post for alternatives.
    • Modularized method packages aren’t supported

提交回复
热议问题