aleclarson / vite-tsconfig-paths

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

Right root, right projects and the wrong tsconfig file is loaded instead in V4 #83

Closed MohamedLamineAllal closed 1 year ago

MohamedLamineAllal commented 1 year ago

Description

tsconfig resolution is not working correctly in v4.0.0

The same vite config file works in v3.6 and not in v4. Here the demonstration bellow:

v4 output

We can see in the log bellow that root and projects are passed correctly. But the loaded file is the wrong one instead (tsconfing.node.json).

playground-1 DEBUG=vite-tsconfig-paths yarn vite
yarn run v1.22.19
$ /Users/mohamedlamineallal/repos/playground/Javascript/react/react-18/typescript/native-base/vite/playground-1/node_modules/.bin/vite
  vite-tsconfig-paths options.root   == /Users/mohamedlamineallal/repos/playground/Javascript/react/react-18/typescript/native-base/vite/playground-1 +0ms
  vite-tsconfig-paths project root   == /Users/mohamedlamineallal/repos/playground/Javascript/react/react-18/typescript/native-base/vite/playground-1 +0ms
  vite-tsconfig-paths workspace root == undefined +0ms
  vite-tsconfig-paths projects: [
  '/Users/mohamedlamineallal/repos/playground/Javascript/react/react-18/typescript/native-base/vite/playground-1/tsconfig.json'
] +1ms
  vite-tsconfig-paths config loaded: {
  configPath: '/Users/mohamedlamineallal/repos/playground/Javascript/react/react-18/typescript/native-base/vite/playground-1/tsconfig.node.json',
  config: {
    compilerOptions: {
      composite: true,
      module: 'ESNext',
      moduleResolution: 'Node',
      allowSyntheticDefaultImports: true
    },
    include: [ 'vite.config.ts' ]
  }
} +3ms
  vite-tsconfig-paths [!] missing baseUrl and paths: "/Users/mohamedlamineallal/repos/playground/Javascript/react/react-18/typescript/native-base/vite/playground-1/tsconfig.node.json" +0ms

  VITE v3.2.5  ready in 270 ms

Dependencies:

"vite": "^3.2.3",
"vite-tsconfig-paths": "~4.0.0"
aleclarson commented 1 year ago

Should be fixed in v4.0.1

MohamedLamineAllal commented 1 year ago

Yup i figured out. was going to close the issue. I published so others find it. And thank you for the awesome work.

use @latest to avoid falling in v4.0.0

npm install vite-tsconfig-paths@latest