Skip to content

Lose sourcemap related too .ts file while use vscode debug #1735

@tianyingchun

Description

@tianyingchun

Search Terms

incorrect debug *.ts file using vscode

Expected Behavior

Should correct located breakpoint on sourcemap file.

Actual Behavior

while debug a.ts using vscode, it will generated new a.ts file mirror, it is transpiled file content,
it should step point source a.ts .

Steps to reproduce the problem

image

{
  "name": "ts-node",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "tsconfig": "ts-node --showConfig",
    "serve": "ts-node ./src/index.ts"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@tsconfig/node16": "^1.0.2",
    "ts-node": "^10.7.0",
    "typescript": "^4.6.4"
  }
}

.vscode

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "runtimeArgs": ["-r", "ts-node/register"],
      "args": ["${workspaceFolder}/src/index.ts"],
      "env": {
        "TS_NODE_PROJECT": ".vscode/tsconfig.json"
      }
    }
  ]
}

image

vscode debug will regenerated new transpiled file

it should be source file is fine.

Minimal reproduction

Specifications

  • ts-node version: "^10.7.0",
  • node version:v17.6.0
  • TypeScript version:"^4.6.4"
  • tsconfig.json, if you're using one:
{
  "extends": "@tsconfig/node16/tsconfig.json",
  "ts-node": {
    // It is faster to skip typechecking.
    // Remove if you want ts-node to do typechecking.
    "transpileOnly": true,
    "files": true,
    "compilerOptions": {
      // compilerOptions specified here will override those declared below,
      // but *only* in ts-node.  Useful if you want ts-node and tsc to use
      // different options with a single tsconfig.json.
      "outDir": "./dist",
      "sourceMap": true
    }
  },
  "compilerOptions": {
    // typescript options here
    // "jsx": "react-jsx"
    "sourceMap": true
  }
}

  • Operating system and version:
  • If Windows, are you using WSL or WSL2?:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions