mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2026-07-25 21:46:08 -04:00
本地运行出错,需要自己手动修改依赖的引入 #16
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jonnzer on GitHub (Jan 29, 2024).
error - ./node_modules/.pnpm/ahooks@3.7.9_react@18.2.0/node_modules/ahooks/lib/utils/lodash-polyfill.js:14:0
Module not found: ESM packages (lodash-es) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals
类似这样的错误,在install包之后,本地开始运行npm run dev就会出现。
举个例子, 其中底层是引用的lodash-es 库,比如node_modules.pnpm\ahooks@3.7.9_react@18.2.0\node_modules\ahooks\lib\useReactive\index.js。这里引用了var _lodashEs = require("lodash-es");
这里会报错,报错原因和解决方式参考这个链接:
Module not found: ESM packages (lodash-es) need to be imported. Use 'import' to reference the package instead. 官方解决
也就是require改为import。
还是不推荐开发者在下好依赖,还要手动修改依赖。期望修复或者有其他建议。
@jonnzer commented on GitHub (Feb 2, 2024):
后来换了设备用高版本node,v20.11.0,没出错了,不好意思~~~