aleclarson / vite-tsconfig-paths

Support for TypeScript's path mapping in Vite
MIT License
1.28k stars 45 forks source link

fix: respect `allowJs` in tsconfig #16

Closed jeremy-coleman closed 3 years ago

jeremy-coleman commented 3 years ago

closer to the intent and won't unnecessarily force users to configure typescript in a way they may not want to

aleclarson commented 3 years ago

Thanks for the PR. It should be allowJs || checkJs, I believe.

allowJs is false by default in tsconfig, so I don't see why users would expect this plugin to support non-TypeScript files by default. Let's revert https://github.com/aleclarson/vite-tsconfig-paths/pull/16/commits/24f2f95296dc0a3be0236222c78b06429ea1fe63 please.

jeremy-coleman commented 3 years ago

Good call , it should definitely be allowJs || checkJs.

Even though tsc is false by default, I still think users expect their js to be resolved and bundled, just not ran through the typescript compiler. There are 4 distinct separate responsibilities all trying to map the tsc config to their use: typechecking, codegen, resolution, and bundling. Your stance is also valid though and its your code ;) making both changes now.

aleclarson commented 3 years ago

Released in v2.5.1