VScode IntelliSense在处理某个打字脚本(NextJs项目)时速度太慢。问题似乎出在node_modules
文件夹,当我删除node_modules
时,智能感知似乎运行得非常快。我尝试了StackOverflow的许多解决方案,但似乎都不起作用。
我试过:
- 禁用所有扩展
- 切换到VScode Insiers版本。
- 将
tsconfig.json
中的target
属性更改为es6
但这个问题仍然存在。
我的tsconfig.json
是这样的:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": "./",
"paths": {
"@components/*": ["./components/*"],
"@containers/*": ["./containers/*"],
"@assets/*": ["./assets/*"],
"@icons/*": ["./assets/Icons/*"],
"@logo": ["./assets/Logo/MemeChat"],
"@styles/*": ["./styles/*"],
"@ui/*": ["./components/UI/*"],
"@aws/*": ["./aws/*"],
"@store/*": ["./store/*"],
"@hooks/*": ["./hooks/*"],
"@reducer/*": ["./reducer/*"],
"@types": ["./types/types.ts"],
"@constants": ["./constants/CONSTANTS.ts"]
},
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", ".next", "node_modules/**", "node_modules/*"]
}
我的package.json
看起来是这样的:
{
"name": "meme-chat",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"host": "next dev -H 192.168.1.7"
},
"dependencies": {
"amazon-cognito-identity-js": "^5.1.0",
"next": "^12.1.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.5"
},
"devDependencies": {
"@types/node": "^18.0.0",
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@types/styled-components": "^5.1.15",
"eslint": "7.32.0",
"eslint-config-next": "11.1.0",
"typescript": "^4.4.4"
}
}
2条答案
按热度按时间8ehkhllq1#
事实证明,这是我的一个特殊的VS代码扩展。Angular 语言服务。禁用这一功能让它变得 lightning 般的迅速。
尝试此操作以查看它是否是特定的分机。
打开命令调色板(Ctrl+Shift+P)输入“禁用所有已安装的扩展模块”,逐个或成组地启用它们,并测试智能感知速度
yfjy0ee72#
我以前也遇到过同样的问题,结果是我忘了将
node_modules
添加到.gitignore
文件中,而Git正在试图跟踪所有文件,因此速度变慢了。看看你是否也犯了同样的错误。