一、现象

Uncaught TypeError: utils.inherits is not a function

二、问题产生原因

Elasticsearch本身就需要这些东西,以前没有问题是因为Webpack4本身就加了node模块的polyfill,而Webpack5和Vite默认是没有这个polyfill的,所以需要自己配置。

三、解决办法

增加2个地方:

1.package.json>devDependencies里增加

 "events": "^3.3.0",
"util": "^0.12.4",

2.vite.config.js ,增加define配置。

export default defineConfig({
plugins: [vue()], define: {
'process.env': {},
}
})

四、最终结果

附范例下载地址

链接:https://pan.baidu.com/s/1QS5M1uDUNm6ePF__XRdr8w

提取码:9r9j

(转发请注明出处:http://www.cnblogs.com/zhangyongli2011/ 如发现有错,请留言,谢谢)

Vue 3 + Vite + SuerMap iClient构建报错Uncaught TypeError utils.inherits is not a function的更多相关文章

  1. jquery3.1.1报错Uncaught TypeError: a.indexOf is not a function

    jquery3.1.1报错Uncaught TypeError: a.indexOf is not a function 使用1.9就没有问题,解决办法: 就是把写的代码中: $(window).lo ...

  2. jQuery3.0+报错Uncaught TypeError: e.indexOf is not a function

    jQuery3.0+报错Uncaught TypeError: e.indexOf is not a function 使用.load()绑定事件时报错,Uncaught TypeError: e.i ...

  3. 使用zepto中animate报错“Uncaught TypeError: this.bind is not a function”的解决办法

    在使用zepto时,我先引入zepto.min.js,然后引入fx.js,但是在使用animate函数时,控制台却报如下错误: Uncaught TypeError: this.bind is not ...

  4. Vue 组件封装发布到npm 报错 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

    Uncaught TypeError: Cannot read property 'toLowerCase' of undefined 原因是 没有导出 export default { name:& ...

  5. 简记webpack运行报错 Uncaught TypeError: self.postMessage is not a function

    说好2017Fix的还是能重现,可能项目的版本比较旧了,简要记录解决办法 1.错误: index.js?bed3:67 Uncaught TypeError: self.postMessage is ...

  6. js报错 Uncaught TypeError: xxxx.each is not a function

    在处理ajax返回的json数组时错误的使用了 list.each(function(){ }); 实际上当遍历json数组是应该使用 $.each(list,function(index,cours ...

  7. vue报错 Uncaught TypeError: Cannot read property of null

    有可能是点击a标签,但是a标签有click事件,未阻止默认事件导致报错,开始都看不出来是什么错误

  8. 报错: Uncaught TypeError: Cannot read property 'prototype' of undefined(Day_43)

    报错原因 引入的js顺序错误,elementUI需要依赖于Vue,调整顺序即可. 调整后

  9. easyui Datagrid查询报错Uncaught TypeError:Cannot read property 'length' of undefined

    1.问题描述 easyui中datagrid执行loadData方法出现如下异常:Cannot read property 'length' of undefined 2.一开始怀疑是js或者页面的问 ...

  10. js 报错 Uncaught TypeError: Cannot read property 'trim' of undefined

    jquery Uncaught TypeError: Cannot read property 'trim' of undefined 报错原因及解决方案 $.trim() 函数用于去除字符串两端的空 ...

随机推荐

  1. TIER 1: Appointment

    TIER 1: Appointment SQL Structured Query Language 是一种用于管理关系型数据库的编程语言.它是一种标准化的语言,用于定义.操作和管理数据库中的数据. 经 ...

  2. 题解:CF1971B Different String

    题解:CF1971B Different String 题意 给予你一个字符串 \(s\),保证 \(s\) 的长度小于等于 \(10\). 任意排列 \(s\),使其与原 \(s\) 不同. 判断是 ...

  3. AngleScript语法

    Class的使用要继承于Interface或者Mixin class.Mixinclass实际上就是类似于抽象类 ,它已经实现的,在子类里面不能实现,类似如下代码: interface AInterf ...

  4. mysql 忘记root密码怎么办?

    忘记root可以跳过grant table来登录 1.打开命令行输入以下命令 mysqld -nt --grant-skip-tables 2.在打开一个新命令行,输入以下命令可以登录, mysql ...

  5. 【MySQL】java.sql.SQLException: Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='

    问题原因参考: http://t.zoukankan.com/zhulei2-p-13451554.html collations 排序规则 Illegal mix 非法混合 SQL报错指出,操作符等 ...

  6. 国产显卡如何正确打开 —— Windows平台下使用驱动精灵为国产显卡更新驱动(兆芯平台)

    买了一个国产的电脑,全国产,CPU慢些也就忍了,软件兼容性差.稳定性差也忍了,大不了就用来上网看电影嘛,关键问题是这个国产显卡放电影居然有些卡,播放电影的时候存在明显的卡顿感,这简直是把国产电脑在我脑 ...

  7. 【转载】 Visual Studio Code几款FTP插件使用总结

    ===================================================== 平时要维护类似wordpress这样的网站,然后虚拟主机又不支持远程仓的版本管理.总而言之, ...

  8. 【转载】 Parallel Computing in Python using mpi4py

    原地址: https://research.computing.yale.edu/sites/default/files/files/mpi4py.pdf ====================== ...

  9. 祝贺小鹏汽车Gallardot同学成为Apache DolphinScheduler Committer!

    社区迎来新committer!这次是来自小鹏汽车的Gallardot,看看他与Apache DolphinScheduler社区的故事吧. 对话社区 Q1:您为Apache DolphinSchedu ...

  10. Linux的命令合集

    Linux常用的命令 这里分享一个博客,里面有很丰富的Linux的常用指令. https://blog.csdn.net/qq_23329167/article/details/83856430. 然 ...