Vite + TS 项目进行 dev 时控制台报出无法追踪的 Uncaught TypeError

Vite + TS 项目进行 dev 时控制台报出无法追踪的 Uncaught TypeError

错误内容如下:

Uncaught TypeError: Cannot read properties of null (reading 'runtime')

at Object.init (content.js:1:148653)

at content.js:1:172541

at content.js:1:172548

init @ content.js:1

(匿名) @ content.js:1

(匿名) @ content.js:1

Uncaught TypeError: Cannot read properties of null (reading 'runtime')

at o (content.js:1:1840)

at HTMLDocument.domContentLoadedListener (content.js:1:154408)

o @ content.js:1

domContentLoadedListener @ content.js:1

项目的依赖:

"dependencies": {

"@egjs/vue3-flicking": "^4.5.1",

"@element-plus/icons-vue": "^0.2.6",

"@types/d3": "^7.1.0",

"d3": "^7.3.0",

"element-plus": "^2.0.1",

"lodash": "^4.17.21",

"lowdb": "^3.0.0",

"vue": "^3.2.29",

"vue-router": "^4.0.12",

"vuex": "^4.0.2",

"wave-ui": "^2.30.0"

},

"devDependencies": {

"@types/lodash": "^4.14.178",

"@types/node": "^17.0.13",

"@vitejs/plugin-vue": "^2.1.0",

"eslint": "^8.7.0",

"prettier": "^2.5.1",

"typescript": "^4.5.5",

"unplugin-auto-import": "^0.5.11",

"unplugin-vue-components": "^0.17.17",

"vite": "^2.7.13",

"vite-plugin-pwa": "^0.11.13",

"vue-tsc": "^0.31.2"

}

错误现象:只是每次加载的时候浏览器控制台会报出这两条错误,但是对实际运行似乎没有影响,也不会影响 HMR 的正常运作。

如果执行 yarn build 构建操作,再 yarn serve 进行本地预览就不会有报错。

看起来 content.js 是在进行了 yarn dev 之后才生成的,目前自己判断认为和 HMR 功能有关,但根本无法确定是哪里出了问题,有经验的大佬可以看看吗,或者指出一些可能的思路?

以上是 Vite + TS 项目进行 dev 时控制台报出无法追踪的 Uncaught TypeError 的全部内容, 来源链接: utcz.com/p/937006.html

回到顶部