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

[Bug] Edge cases in ts-node #162

Closed
carlocorradini opened this issue Oct 21, 2022 · 2 comments
Closed

[Bug] Edge cases in ts-node #162

carlocorradini opened this issue Oct 21, 2022 · 2 comments
Labels
Bug Something isn't working

Comments

@carlocorradini
Copy link
Contributor

carlocorradini commented Oct 21, 2022

Maintainers Note

ts-node was updated with new internal logic. Formerly, ts-node would pass no Program instance when it was executed with the transpileOnly option.

Recent logic has changed to where it passes a stripped Program, which was causing several issues. I attempted to fix this in (3.4.0), but there were some edge cases that were not covered, as evidenced by the following bug report.

We have corrected the logic to better accommodate these changes and ts-node in both transpileOnly and typeCheck modes.


Bug Report

Context

Project available at https://github.com/carlocorradini/reCluster/tree/main/server

tsconfig.json

Available at https://github.com/carlocorradini/reCluster/blob/main/server/tsconfig.json
Content:

{
  "compilerOptions": {
    // ...
    "paths": {
      "~*": ["./src/*"]
    },
    // ...
    "plugins": [
      {
        "transform": "typescript-transform-paths"
      },
      {
        "transform": "typescript-transform-paths",
        "afterDeclarations": true
      }
    ]
  },
}

Problem

ts-patch has been correctly applied.
In development I use ts-node-dev and start the server with the following npm script:

npx ts-node-dev --respawn --clear --rs --transpile-only --require tsconfig-paths/register src/main.ts

It worked flawlessly until I've updated typescript-transform-paths to v3.4.0:

Error: Cannot find module '...'
Require stack: ...

What is the possible cause of this?
Thanks! 🥳😥

@nonara nonara closed this as completed in 0dbe06e Oct 21, 2022
@nonara nonara changed the title Upgrading to v3.4.* broke something [Bug] Edge cases in ts-node Oct 21, 2022
@nonara
Copy link
Collaborator

nonara commented Oct 21, 2022

Thanks for the report! This should be fixed in v3.4.2. Let me know if you still face any issues.

Issue Details

ts-node was updated with new internal logic. Formerly, ts-node would pass no Program instance when it was executed with the transpileOnly option.

Recent logic has changed to where it passes a stripped Program, which was causing several issues. I attempted to fix this in (3.4.0), but there were some edge cases that were not covered, as evidenced by the following bug report.

We have corrected the logic to better accommodate these changes and ts-node in both transpileOnly and typeCheck modes.

@nonara nonara added the Bug Something isn't working label Oct 21, 2022
@carlocorradini
Copy link
Contributor Author

Awesome! It's working now. Thanks! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants