如何解决模块解析失败:额外的 babel_loader
我已经使用 react-leaflet 一段时间了,几周后我删除了 node_modules 中的文件并重新安装了它们,我根本没有接触 react-leaflet 版本,但是当我尝试运行时项目,它给了我一个错误。
./node_modules/@react-leaflet/core/esm/path.js 10:41 模块解析失败:意外令牌 (10:41) 文件是用这些加载程序处理的:
- ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js 您可能需要一个额外的加载器来处理这些加载器的结果。 | useEffect(function updatePathOptions() { | if (props.pathOptions !== optionsRef.current) {
const options = props.pathOptions ?? {};
| element.instance.setStyle(options); | optionsRef.current = 选项;
解决方法
首先
删除反应传单
然后将您的 react-scripts 版本更新为 3.3.0 或更高版本,对我来说是 4.0.3
然后删除 node_module 目录
然后运行:npm cache clean --force
最后,运行:npm i react-leaflet@3.1.0 @react-leaflet/core@1.0.2
它对我有用......
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。