美文网首页
让你的lodash自动导入

让你的lodash自动导入

作者: 小遁哥 | 来源:发表于2020-07-09 22:29 被阅读0次

效果是这样的


然后

主要有两个依赖

"dependencies": {
      "lodash": "^4.17.11",
...
 "devDependencies": {
      "@types/lodash": "^4.14.144",
...

我用的是umi3.x + antd4.x需要其它依赖文件引用了lodsh,才会自动提示

比如我就在global.tsx 加入了

import {} from "lodash";

新加入还需要重启VS code

然后你要等待程序初始化好了以后


上述方法用lodash在构建的时候会100kb,用lodash-es则不会影响,但是会提升两次,像下面这样

感觉这些问题后面都能被解决的...

这个项目不需要考虑打包,就直接用lodash

gitthub地址:https://github.com/xiaodun/sf-pc-web/tree/v2.0

相关文章

网友评论

      本文标题:让你的lodash自动导入

      本文链接:https://www.haomeiwen.com/subject/xilecktx.html