-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging fails in TS files with any imports #69
Comments
I'm wondering if this issue is related, until I opened the REPL, the the only message I was seeing was identical to what's described here: |
I'm having this same issue on a NestJS project. @josephemorgan did you ever find a workaround? |
I haven't yet, and I have spent literally weeks trying. Since posting this issue, I've spent a few hours every weekend trying everything I can think of or can find in a video or guide. It's making wonder if anyone has a config where debugging works in a typescript nest application. |
@josephemorgan I was able to get it working without this plugin but using LazyVim and Mason. Here's the config that worked for me: {
name = "Launch NestJS (Debug Mode)",
type = "pwa-node",
request = "launch",
cwd = vim.fn.getcwd(),
runtimeExecutable = "npm", -- Specify npm as the runtime executable
args = { "run", "start:debug" }, -- Pass the run command and script name as arguments
sourceMaps = true,
protocol = "inspector",
console = "integratedTerminal",
outFiles = { "${workspaceFolder}/dist/**/*.js" },
skipFiles = {
"${workspaceFolder}/node_modules/**/*.js",
"<node_internals>/**",
},
},
|
Was wondering if it worked in LazyVim, I'll have to check out their config and see if I can replicate the DAP part of it. Thanks for updating |
The Problem
Unable to debug anything that has an ESM import (which is the standard for writing TS as far as I'm aware).
Debugging works in single-file typescript programs. Once there's an ESM module import, the following error appears in the REPL and the debugger disconnects:
What I tried
Changing
type
tomodule
inpackage.json
changes the error in the REPL to the following:The warning suggests changing the file extension to
mjs
, which doesn't make sense, tried changing to 'mts' instead an got the same error as initially in the REPLTried switching to commonjs module syntax
No combination of ts/mts extensions or
"type" = "module"
inpackage.json
would allow the debugger to run without a similar message in the repl.My config is basically copy/pasted from the docs here,
vscode-js-debug
was cloned and built today, as were basically all of the nvim plugins I'm using.nvim: 0.9.5
Reproduction
I've set up the most basic, default Hello World typescript project I can image: https://github.com/josephemorgan/ts_helloworld
The text was updated successfully, but these errors were encountered: