I want to be able to step through my “index.ts” in Strapi v4 for debugging purposes, but my breakpoints will not bind.
I followed the instruction from this “stackoverflow” post debugging-strapi-in-visual-studio-code, but it did not worked. Has anyone get the debug session working in VS code for Strapi v4? If so, would you be kind enough to share your approach step-by-step?
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Strapi v4 Debug",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "node",
"runtimeArgs": ["--inspect"],
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/node_modules/@strapi/strapi/bin/strapi.js",
"args": ["develop"],
"autoAttachChildProcesses": true,
"console": "integratedTerminal"
}
]
}
With Typescript and Strapi v4.4.3 I just needed to add the “sourceMap”:true to the tsconfig.json file and then I could use the usual (at least for me) launch.json configuration for debugging Strapi: