Strapi v4 debug breakpoints do not bind in VS Code

I also had trouble with this due to the Typescript compilation. This is what worked for me:

// tsconfig.json
{
  "extends": "@strapi/typescript-utils/tsconfigs/server",
 
  "compilerOptions": {
    "outDir": "dist",
    "rootDir": ".",
    "sourceMap": true,
  },
  "include": [
    "./",
    "src/**/*.json"
  ],
  "exclude": [
    "node_modules/",
    "build/",
    "dist/",
    ".cache/",
    ".tmp/",
    "src/admin/",
    "**/*.test.ts",
    "src/plugins/**"
  ]
}

and

// launch.json > configurations
     {
        "name": "Strapi Develop",
        "request": "launch",
        "runtimeArgs": [
          "run-script",
          "develop"
        ],
        "sourceMaps": true,
        "runtimeExecutable": "npm",
        // I have multiple folders in the workspace
        "cwd": "${workspaceFolder}/backend",
        "skipFiles": [
          "<node_internals>/**"
        ],
        "type": "node"
      }
1 Like