react17安装html-react-parser运行报错记录

背景

react@17 安装 html-react-parser

powershell 复制代码
npm install html-react-parser

运行终端报错信息

powershell 复制代码
ERROR in ./node_modules/html-react-parser/esm/index.mjs 2:0-122 
Can't reexport the named export 'htmlToDOM' from non EcmaScript module (only default export is available)

原因

版本不匹配

react@17 安装 html-react-parser@3.0.9 亲测匹配

参考: https://github.com/peternewnham/react-html-parser/issues/84

相关推荐
先吃饱再说3 分钟前
别说你懂 useEffect:从底层机制到生命周期管理,这篇全讲透了
react.js·前端框架
先吃饱再说9 分钟前
从“传事件”到“只传值”:React + TypeScript 组件 Props 设计的两次进化
react.js·前端框架·前端工程化
破z晓19 分钟前
javascript 导出excel表
开发语言·javascript·excel
小罗水2 小时前
第17章 后台管理端与演示支持
javascript·vue.js·ecmascript
万少3 小时前
DeepSeek-V4-Flash 正式版上线了,但这 3 个坑我帮你提前踩了
前端·javascript·后端
宁风NF3 小时前
JavaScript:网络请求与前端通信
开发语言·前端·javascript·网络·学习·ecmascript
猫猫不是喵喵.4 小时前
Vue3 中 computed 计算属性与 watch、watchEffect 监听
前端·javascript·vue.js
猫猫不是喵喵.5 小时前
Vue2 的 Vuex 状态管理与 Vue3 的 Pinia 状态管理
前端·javascript·vue.js
看昭奚恤哭6 小时前
Flutter 布局核心思想
开发语言·javascript·flutter
朝阳5816 小时前
Cesium `Camera.flyTo`:“飞过去“
javascript