tsconfig / bases

Hosts TSConfigs to extend in a TypeScript app, tuned to a particular runtime environment
MIT License
6.21k stars 231 forks source link

Add bundler config #229

Closed vladshcherbin closed 11 months ago

vladshcherbin commented 11 months ago

Hi 👋

I'm using node v20 and tsx

@tsconfig/node20 has module set to node16 so imports without extensions are not supported. tsx has support for such imports. According to handbook guide it's advised to use esnext and bundler with tsx, bun and other bundlers.

Does it make sense to create a simple base config for bundlers?

"module": "esnext"
"moduleResolution": "bundler"

It would make possible to use it this way:

{
  "extends": [
    "@tsconfig/node20",
    "@tsconfig/bundler"
  ]
}
orta commented 11 months ago

I don't think so, I think that your runtime is node but that your specific app uses the bundler resolution - so having that in your tsconfig is showing the right information about your specific project (instead of hiding it in a shared bundler tsconfig)

vladshcherbin commented 11 months ago

Good to know, I was a bit confused after reading multiple issues on TS module resolution configuration. Thank you for the clarification.

Hopefully this will also be helpful for other devs having the same question 🙌