local dap = require("dap") -- https://github.com/microsoft/vscode-node-debug2 dap.adapters.node2 = { type = "executable", command = "node", args = { vim.fn.stdpath("data") .. "/mason/packages/node-debug2-adapter/out/src/nodeDebug.js" }, } -- https://github.com/Microsoft/vscode-chrome-debug dap.adapters.chrome = { type = "executable", command = "node", args = { vim.fn.stdpath("data") .. "/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js" }, } dap.configurations.javascript = { { name = "Launch", type = "node2", request = "launch", program = "${file}", cwd = vim.fn.getcwd(), sourceMaps = true, protocol = "inspector", console = "integratedTerminal", }, { -- For this to work you need to make sure the node process is started with the `--inspect` flag. name = "Attach to process", type = "node2", request = "attach", processId = require("dap.utils").pick_process, }, } dap.configurations.javascriptreact = { -- change this to javascript if needed { type = "chrome", request = "attach", program = "${file}", cwd = vim.fn.getcwd(), sourceMaps = true, protocol = "inspector", port = 9222, webRoot = "${workspaceFolder}", }, } dap.configurations.typescriptreact = { -- change to typescript if needed { type = "chrome", request = "attach", program = "${file}", cwd = vim.fn.getcwd(), sourceMaps = true, protocol = "inspector", port = 9222, webRoot = "${workspaceFolder}", }, }