Closed liaolongdong closed 8 months ago
请问方便提供一个仓库进行复现吗
---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2024年02月01日 23:36 | | 收件人 | @.> | | 抄送至 | @.***> | | 主题 | [zh-lx/code-inspector] vite+vue3+vitest项目引入报错vendor-vi.dd6706cb.js:3226 Uncaught Error: Vitest failed to access its internal state. (Issue #103) |
大佬帮忙看一下,vite+vue3+vitest项目引入报错vendor-vi.dd6706cb.js:3226 Uncaught Error: Vitest failed to access its internal state. 把CodeInspectorPlugin注释掉,这个错误就没了 image.png (view on web)
image.png (view on web)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
感谢,我拉下来排查下
---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2024年02月01日 23:47 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [zh-lx/code-inspector] vite+vue3+vitest项目引入报错vendor-vi.dd6706cb.js:3226 Uncaught Error: Vitest failed to access its internal state. (Issue #103) |
https://github.com/liaolongdong/vue3-ts-vite
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
经排查是因为插件打包后的客户端注入代码经过压缩和混淆后,混淆后的变量有的名为 it
,所以 autoImport 插件误判了应该引入 vitest
中的 it
函数,从而导致报错。
我针对这个问题优化了下 vite 中的注入逻辑并发布了 0.6.4
版本,经测试 0.6.4
版本不再有报错,可以安装 0.6.4
版本使用。(但是感觉你 autoImport 的包太多了,这样写项目容易有变量命名冲突风险,建议项目最好也优化下)
大佬帮忙看一下,vite+vue3+vitest项目引入报错vendor-vi.dd6706cb.js:3226 Uncaught Error: Vitest failed to access its internal state. 把
CodeInspectorPlugin
注释掉,这个错误就没了