React vitejs Unexpected string

huangapple go评论86阅读模式
英文:

React vitejs Unexpected string

问题

我在我的 Vite 项目中安装了 @apollo/client 库,当我从 apollo 库中调用 new InMemoryCache() 时,我得到了控制台错误 Uncaught SyntaxError: Unexpected string。如果我点击引发错误的文件(apollo 依赖项),下面是被红色下划线标记的行:

((_globalThis$process = globalThis.process) === null || _globalThis$process === void 0 ? void 0 : _globalThis$"development") === "production" ? function instanceOf2(value, constructor) {
    return value instanceof constructor;

我尝试了很多方法,使用不同的缓存库,修改 Vite 配置文件,但我找不到解决方案。

英文:

I was installing the @apollo/client library in my vite project and when i called

new InMemoryCache() from the apollo library i got console error Uncaught SyntaxError: Unexpected string

And if i clicked on the file where the error comed from (apollo dependency) this wa the red underlined line ((_globalThis$process = globalThis.process) === null || _globalThis$process === void 0 ? void 0 : _globalThis$"development") === "production" ? function instanceOf2(value, constructor) {
return value instanceof constructor;

I tried so many things, using different cache libraries, changing vite condig js but I couldn't find the solution

答案1

得分: 2

这可能是与 graphql 包的版本 16.7.0 引入的错误。请暂时降级到 16.6.0 版本,我们正在调查此问题。


编辑:现在应该已经在 16.7.1 版本中修复了。

英文:

This could be an error introduced with version 16.7.0 of the graphql package. Please downgrade for 16.6.0 for now, we are looking into this.


Edit: this should be fixed with 16.7.1 now.

答案2

得分: 1

我也在16.7.1版本中遇到了这个错误。

node --version v18.16.1
npm --version 9.5.1

目前唯一有效的方法是降级到16.6.0,就像Mark Kurkowski所说的一样!

英文:

i got that error also in 16.7.1.

node --version v18.16.1
npm --version 9.5.1

Only thing that works right now is to downgrade to 16.6.0 like Mark Kurkowski said!

huangapple
  • 本文由 发表于 2023年6月22日 05:56:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76527409.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定