privatenumber / tsx

⚡️ TypeScript Execute | The easiest way to run TypeScript in Node.js
https://tsx.is
MIT License
9.52k stars 145 forks source link

`tsx` not working with the new `${configDir}` template variable from `tsconfig.json` #649

Closed ivodolenc closed 1 month ago

ivodolenc commented 1 month ago

Acknowledgements

Minimal reproduction URL

-

Problem & expected behavior (under 200 words)

Hi, TypeScript released a new ${configDir} template variable option in 5.5.0 version.

This is super useful when using shared configs from npm.

I just tested it and tsx doesn't seem to resolve the path alias as it should and throws error when building.

Here's a simple example of tsconfig that doesn't work when tsx starts building, but the alias works normally in the project as expected, with no errors:

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "baseUrl": "${configDir}",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "include": ["src/**/*"]
}

Here is a simple example of tsconfig working normally when tsx starts building and alias also working normally without errors:

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "baseUrl": "./",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "include": ["src/**/*"]
}

Bugs are expected to be fixed by those affected by it

Compensating engineering work will speed up resolution and support the project

privatenumber commented 1 month ago

Did you see this warning in the issue template?

Without proving the bug is in tsx via minimal reproduction, your issue will be closed without response.

Happy to re-open once a reproduction is provided.

ivodolenc commented 1 month ago

Okay, this is a friendly bug report if you don't want to test it that's fine with me.

Try the simple instructions I have provided. Simply add ${configDir} in any project to the tsconfig.json file and try to run the tsx build.

privatenumber commented 1 month ago

To be friendly, please do your best to respect the instructions.

We had too many bug reports where we follow the instructions and it works fine and we lose time.

Proving the bug exists is the least you can do when asking strangers for free work.

ivodolenc commented 1 month ago

I'm not asking you for anything, least of all to do something for free. Feel free to ignore this report. Cheers!