Skip to content
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

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

Closed
Milestone

Comments

@LiamAttClarke
Copy link

LiamAttClarke commented Jun 15, 2022

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 [email protected]
npm install [email protected]
  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
@Philluxx
Copy link

Same here. I can confirm this. With 10.8.1 debugging isnt possible anymore. Everthing fine with 10.8.0.

@cspotcode
Copy link
Collaborator

cspotcode commented Jun 27, 2022 via email

@cspotcode cspotcode added this to the 10.8.2 milestone Jul 2, 2022
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this issue Jul 11, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ts-node](https://typestrong.org/ts-node) ([source](https://github.com/TypeStrong/ts-node)) | devDependencies | patch | [`10.8.1` -> `10.8.2`](https://renovatebot.com/diffs/npm/ts-node/10.8.1/10.8.2) |

---

### Release Notes

<details>
<summary>TypeStrong/ts-node</summary>

### [`v10.8.2`](https://github.com/TypeStrong/ts-node/releases/tag/v10.8.2)

[Compare Source](TypeStrong/ts-node@v10.8.1...v10.8.2)

**Fixed**

-   Revert "Use file URL for source map paths" ([#&#8203;1821](TypeStrong/ts-node#1821)) [@&#8203;cspotcode](https://github.com/cspotcode)
    -   Fixes [#&#8203;1790](TypeStrong/ts-node#1790): ts-node 10.8.1 regression where `nyc` code coverage reports had incorrect paths
    -   Fixes [#&#8203;1797](TypeStrong/ts-node#1797): ts-node 10.8.1 regression where breakpoints did not hit in VSCode debugging
-   Allow JSON imports in node 16.15 and up ([#&#8203;1792](TypeStrong/ts-node#1792)) [@&#8203;queengooborg](https://github.com/queengooborg)
    -   JSON imports were already supported in v17.5 and up
    -   this change extends support to >=16.15.0,<17.0.0
    -   These version ranges match vanilla node's support for JSON imports

https://github.com/TypeStrong/ts-node/milestone/15?closed=1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <[email protected]>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1446
Reviewed-by: Epsilon_02 <[email protected]>
Co-authored-by: Calciumdibromid Bot <[email protected]>
Co-committed-by: Calciumdibromid Bot <[email protected]>
@a7madgamal
Copy link

looks like it's still happening for 10.9.1

@a7madgamal
Copy link

actually even with 10.8.2 🤦
my setup is a bit complex but mainly running cucumber tests with wdio driver for react-native testing. using TS for config and tests and wdio internally uses ts-node if present to compile on the fly.
seems the debugger and also the error stacks numbers are off by 5 lines or so
I can provide more details if needed and I appreciate any help to debug it myself even

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment