VScode intellisense very slow when 'node_modules' is present

Viewed 106

VScode intelliSense is way too slow when working with a certain TypeScript, NextJs project. The problem seemed to be the node_modules folder, when i delete node_modules the intelliSense seem to be working very fast. I've tried many solutions from StackOverflow nothing seems to work.

I tried :

  • Disabling all the extensions
  • Switched to VScode insiders version.
  • Change target attribute to es6 in tsconfig.json

but the problem still persist.

My tsconfig.json looks like this :

{
    "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/*"]
}

My package.json looks like this :

{
    "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"
    }
}
1 Answers

It turned out it was a particular VS Code extension for me. Angular Language Service. Disabling this made it lightning quick.

Try this to see if it is a particular extension.

Open Command Palette (Ctrl+Shift+P) Type in "Disable all installed extensions" Enable them one by one or in groups and test the intellisense speed

Related