Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 客户端与nextjs存在冲突,导致IDE报红 || [Bug]: There is a conflict between the client and nextjs, causing the IDE to report red #2124

Closed
zS1m opened this issue Oct 18, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@zS1m
Copy link

zS1m commented Oct 18, 2023

问题描述 | Describe the bug

运行环境
os: windows11
node: 18.16.0
npm: 9.5.1
ide: IntelliJ IDEA 2023.2.3

// package.json
{
  "name": "waline-test",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "13.5.5",
    "react": "^18",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "@waline/client": "^2.15.8",
    "autoprefixer": "^10",
    "postcss": "^8",
    "tailwindcss": "^3",
    "typescript": "^5"
  }
}

在nextjs中安装@waline/client时,会导致编辑器报错

Vue: Type  Element  is not assignable to type  ReactNode 

可以正常编译,不影响编译结果,因此下方的网站是正常的

复现方法:
1、安装nextjs

npx create-next-app@latest

2、安装@waline/client

npm i @waline/client -D

3、重新启动IDE即可观察到tsx文件中报错

问题网站 | Website URL

https://contrails.space

服务部署在哪里? | Where your waline deploy?

Vercel (Default)

数据存储在哪里?| Where your comment data store?

LeanCloud(https://leancloud.app)


Problem description | Describe the bug

Operating environment
os: windows11
node: 18.16.0
npm: 9.5.1
ide: IntelliJ IDEA 2023.2.3

// package.json
{
  "name": "waline-test",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "13.5.5",
    "react": "^18",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "@waline/client": "^2.15.8",
    "autoprefixer": "^10",
    "postcss": "^8",
    "tailwindcss": "^3",
    "typescript": "^5"
  }
}

When installing @waline/client in nextjs, it will cause the editor to report an error

Vue: Type Element is not assignable to type ReactNode

It can be compiled normally and does not affect the compilation results, so the website below is normal.

Reproduction method:

  1. Install nextjs
npx create-next-app@latest
  1. Install @waline/client
npm i @waline/client -D
  1. Restart the IDE to observe the error reported in the tsx file.

Question Website | Website URL

https://contrails.space

Where is the service deployed? | Where your waline deploy?

Vercel (Default)

Where is the data stored? | Where your comment data store?

LeanCloud(https://leancloud.app)

@zS1m zS1m added the bug Something isn't working label Oct 18, 2023
@github-actions github-actions bot changed the title [Bug]: 客户端与nextjs存在冲突,导致IDE报红 [Bug]: 客户端与nextjs存在冲突,导致IDE报红 || [Bug]: There is a conflict between the client and nextjs, causing the IDE to report red Oct 18, 2023
@lizheming
Copy link
Collaborator

lizheming commented Oct 19, 2023

没有使用过 IDEA,不过 @waline/client 是一个 Vue 的项目,感觉像是检测到了包里面的 src 目录的 vue 文件导致的。可以尝试看是不是可以加一些配置忽略 node_modules/@waline/client 目录的检测来解决这个问题。


I have never used IDEA, but @waline/client is a Vue project, and it feels like it is caused by detecting the vue file in the src directory in the package. You can try to see if you can add some configuration to ignore the detection of the node_modules/@waline/client directory to solve this problem.

@lizheming lizheming added help wanted Extra attention is needed and removed bug Something isn't working labels Oct 19, 2023
@walinejs walinejs deleted a comment from github-actions bot Oct 19, 2023
@zS1m
Copy link
Author

zS1m commented Oct 20, 2023

没有使用过 IDEA,不过 @waline/client 是一个 Vue 的项目,感觉像是检测到了包里面的 src 目录的 vue 文件导致的。可以尝试看是不是可以加一些配置忽略 node_modules/@waline/client 目录的检测来解决这个问题。

I have never used IDEA, but @waline/client is a Vue project, and it feels like it is caused by detecting the vue file in the src directory in the package. You can try to see if you can add some configuration to ignore the detection of the node_modules/@waline/client directory to solve this problem.

感谢解答,我已经确认是IDEA的问题并反馈给了IDEA团队,这里提供一个临时的解决方法给遇到同样问题的小伙伴们:
点击 文件 -> 设置 -> 语言和框架 -> TypeScript -> Vue,选择最后一项“TypeScript服务”或第一项“已禁用”,该解决方法没有测试是否会对Vue工程产生副作用,慎用。 该方法仅对单个工程生效,无需担心是否会影响其他工程。

@zS1m zS1m closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants