Skip to content

10.8.1 regression - sourcemaps are invalid resulting in an unusable debugger #1797

Closed
@LiamAttClarke

Description

@LiamAttClarke

Search Terms

  • source maps
  • debugger
  • 10.8.1

Expected Behavior

Debugger should be able to set breakpoints in source .ts files that map correctly to the transpiled code generated by ts-node.

Actual Behavior

Breakpoints set in source files are not being registered on correct lines in the transpiled js.

NOTE: This issue is a regression in 10.8.1, tested 10.8.0 with no issues.

Steps to reproduce the problem

  1. Install ts-node@10.8.1
npm install ts-node@10.8.1
  1. Launch node with the debugger port open:
node --inspect=0.0.0.0:9229 -r ts-node/register ./src/main.ts
  1. Set breakpoint in source file (I set mine via VSCode)
  2. Attempt to hit breakpoint

Minimal reproduction

Posting without reproduction for now. Will update with minimal example later in the day.

Specifications

  • ts-node version: 10.8.1
  • node version: v16.14.0
  • TypeScript version: 4.7.2
  • tsconfig.json, if you're using one:
{
  "compilerOptions": {
    "target": "esnext",
    "module": "commonjs",
    "moduleResolution": "node",
    "strict": true,
    "useDefineForClassFields": true,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "noImplicitAny": true,
    "sourceMap": true,
    "typeRoots": [
      "./node_modules/@types",
      "./typings"
    ],
    "strictNullChecks": false
  },
  "include": [
    "./src/**/*",
    "./tests/**/*"
  ],
  "ts-node": {
    "swc": true,
  }
}
  • package.json:
{
  "name": "dontworryaboutit",
  "version": "0.0.1",
  "description": "",
  "license": "UNLICENSED",
  "main": "dist/main.js",
  "scripts": {
    "build": "tsc -p tsconfig.build.json",
    "start": "node ./dist/src/main.js",
    "start:dev": "node --inspect=0.0.0.0:9229 -r ts-node/register ./src/main.ts",
    "start:watch": "nodemon",
    "test": "ts-mocha -p tsconfig.json tests/**/*.spec.ts"
  },
  "dependencies": {
    "@googleapis/drive": "^2.3.0",
    "@graphql-tools/load-files": "^6.5.3",
    "@graphql-tools/merge": "^8.2.1",
    "@graphql-tools/schema": "^8.3.1",
    "@protobuf-ts/runtime": "^2.1.0",
    "@types/jsdom": "^16.2.14",
    "amqplib": "^0.9.0",
    "axios": "^0.26.1",
    "cypher-query-builder": "^6.0.4",
    "dropbox": "^10.29.0",
    "exponential-backoff": "^3.1.0",
    "express": "^4.17.2",
    "express-graphql": "^0.12.0",
    "gm": "^1.23.1",
    "graphql": "^16.2.0",
    "inkscape": "^3.1.1",
    "jsdom": "^19.0.0",
    "mime-types": "^2.1.35",
    "mkdirp": "^1.0.4",
    "sharp": "^0.30.4",
    "ssh2-sftp-client": "^8.1.0",
    "svgson": "^5.2.1",
    "ts-node": "10.8.0",
    "uuid": "^8.3.2"
  },
  "devDependencies": {
    "@swc/core": "^1.2.194",
    "@swc/helpers": "^0.3.16",
    "@types/amqplib": "^0",
    "@types/chai": "^4",
    "@types/express": "^4",
    "@types/gm": "^1",
    "@types/mime-types": "^2",
    "@types/mkdirp": "^1.0.2",
    "@types/mocha": "^9",
    "@types/node": "^17.0.8",
    "@types/sharp": "^0",
    "@types/ssh2-sftp-client": "^7.0.1",
    "@types/uuid": "^8",
    "chai": "^4.3.4",
    "mocha": "^9.1.3",
    "nodemon": "^2.0.15",
    "regenerator-runtime": "^0.13.9",
    "ts-mocha": "^9.0.2",
    "tslib": "^2.3.1",
    "typescript": "^4.5.4"
  }
}

  • Operating system and version: Windows 11 Pro (21H2)
  • If Windows, are you using WSL or WSL2?: WSL2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions