Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lodash-es 代替 lodash #2220

Closed
The-End-Hero opened this issue Jun 16, 2023 · 6 comments · Fixed by #2233
Closed

lodash-es 代替 lodash #2220

The-End-Hero opened this issue Jun 16, 2023 · 6 comments · Fixed by #2233

Comments

@The-End-Hero
Copy link

rt

@crazylxr
Copy link
Collaborator

crazylxr commented Jun 19, 2023

有什么参考文档么,为什么要用 lodash-es 来代替

@The-End-Hero
Copy link
Author

有什么参考文档么,为什么要用 lodash-es 来代替

https://juejin.cn/s/lodash-es%20vs%20lodash

@liuyib
Copy link
Collaborator

liuyib commented Jun 25, 2023

@The-End-Hero
image

ahooks 代码里使用 lodash 都是这样用的:

import xxx from 'lodash/xxx';

等价于

import { xxx } from 'lodash-es';

不会额外增大包体积。

见你提供的参考资料中也提到,用了打包工具两者是都可以的。只不过用 lodash-es 后导入时语法会简单些。

目前这个包的替换不是特别急迫的事,不换也没任何影响(只是开发时导入语法繁琐了点)

@liuyib
Copy link
Collaborator

liuyib commented Jun 25, 2023

不过我觉着可以来个 PR 优化下?应该替换下依赖和语法就可以 @The-End-Hero

@Ali-ovo
Copy link
Contributor

Ali-ovo commented Jun 25, 2023

我来吧

@sxy-git
Copy link

sxy-git commented Jan 31, 2024

image build error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants