导入lodash的正确方法 - Correct way to import lodash

10/14 17:03
阅读数 0

问题:

I had a pull request feedback below, just wondering which way is the correct way to import lodash?我在下面有一个 pull request 反馈,只是想知道导入 lodash 的正确方法是什么?

You'd better do import has from 'lodash/has'.. For the earlier version of lodash (v3) which by itself is pretty heavy, we should only import a specidic module/function rather than importing the whole lodash library.你最好使用 import has from 'lodash/has'.. 对于 lodash (v3) 的早期版本,它本身就很重,我们应该只导入一个特定的模块/函数,而不是导入整个 lodash 库。 Not sure about the newer version (v4).不确定新版本(v4)。

import has from 'lodash/has';

vs对比

import { has } from 'lodash';

Thanks谢谢


解决方案:

参考一: https://en.stackoom.com/question/2NuGS
参考二: https://stackoom.com/question/2NuGS
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部