gpt4 book ai didi

Vite react typescript error in tsconfig.json(Tsconfig.json中的Vite Reaction打字脚本错误)

转载 作者:bug小助手 更新时间:2023-10-25 23:18:10 25 4
gpt4 key购买 nike



I am facing an error in tsconfig.json when I try to install React with TypeScript using Vite. Here's the line where I am facing error.

当我尝试使用VITE安装Reaction with TypeScrip时,我在tsfig.json中遇到错误。这就是我面临错误的地方。


/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true

The same codebase works well on my colleague's PC, but I am facing this issue.

同样的代码库在我同事的PC上运行得很好,但我面临着这个问题。


To resolve the issue, I changed my TypeScript version from 5.2.2 to 4.8. I also checked that my TypeScript is installed globally. but not working.

为了解决这个问题,我将TypeScript版本从5.2.2更改为4.8。我还检查了我的TypeScript是否全局安装。但不管用


更多回答

I am facing import issues. when I am importing something this shows me error like that Cannot find module '../../components/atoms/toast'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? . but other PC works well except my PC.

我正面临进口问题。当我导入某些东西时,这会显示错误,如找不到模块‘../../Components/ATOM/toast’。您的意思是要将‘模块分辨率’选项设置为‘node’,还是要为‘路径’选项添加别名?但除了我的电脑外,其他电脑都运行得很好。

Do you have a "components" folder two levels up from where you import it, which contains an "atoms" folder with a "toast.ts" file inside it?

您是否有一个位于导入位置上两级的“Components”文件夹,其中包含一个“ATOM”文件夹,其中包含一个“toast.ts”文件?

yes, I have toast.tsx

是的,我要吐司。

Without a minimal reproducible example here, there's not much we can use to help you. Please edit your question with that example.

如果这里没有一个最小的可重现的示例,我们就没有什么可以用来帮助您的。请用那个例子编辑你的问题。

优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com