Open janakg opened 1 year ago
Use DEBUG="vite-tsconfig-paths" vite dev
and paste the logs here
Thanks! for quick response. 3.6.0 also has same logs but bundling works, in case of 4.0.3 bundling fails.
o/p of DEBUG="vite-tsconfig-paths" yarn vite dev
VITE v4.0.1 ready in 96 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h to show help
The following dependencies are imported but could not be resolved:
@sivi/color-lib (imported by /Users/janakg/cosmos/hub/templates/electron-app-main-template/src/renderer/app/index.tsx)
resources/styles/globals.sass (imported by /Users/janakg/cosmos/hub/templates/electron-app-main-template/src/renderer/app/index.tsx)
mathwasm (imported by /Users/janakg/cosmos/hub/templates/electron-app-main-template/src/renderer/app/index.tsx)
@app/screens (imported by /Users/janakg/cosmos/hub/templates/electron-app-main-template/src/renderer/app/routes.tsx)
Seems like vite-tsconfig-paths
isn't being used (or DEBUG
isn't being applied correctly), as none of its logs are visible there. Could you try running DEBUG="vite-tsconfig-paths" node_modules/.bin/vite dev
instead?
@aleclarson it is used for sure, else I am getting error
import tsconfigPathsPlugin from 'vite-tsconfig-paths'
const tsconfigPaths = tsconfigPathsPlugin({
projects: [
resolve('tsconfig.json'),
resolve('../common-libs/color-lib/tsconfig.json'),
],
})
defineConfig({
plugins: [tsconfigPaths]
}
Debug is not working for both commands I am using it inside electron-vite config , which inturn uses vite
I'll send you a test repo, if that helps
That would help
get same issue: Running tsconfig-paths in DEBUG mode gives:
[4/4] Building fresh packages...
Done in 27.32s.
2022-12-16T06:31:21.127Z vite-tsconfig-paths options.root == undefined
2022-12-16T06:31:21.128Z vite-tsconfig-paths project root == /home/runner/work/tauri-mobile/tauri-mobile
2022-12-16T06:31:21.128Z vite-tsconfig-paths workspace root == /home/runner/work/tauri-mobile/tauri-mobile
2022-12-16T06:31:21.240Z vite-tsconfig-paths projects: [
'/home/runner/work/tauri-mobile/tauri-mobile/tauri/examples/web/tsconfig.json',
'/home/runner/work/tauri-mobile/tauri-mobile/tauri/tooling/api/tsconfig.json',
'/home/runner/work/tauri-mobile/tauri-mobile/tauri/tooling/cli/templates/plugin/with-api/examples/svelte-app/tsconfig.json',
'/home/runner/work/tauri-mobile/tauri-mobile/tauri/tooling/cli/templates/plugin/with-api/webview-src/tsconfig.json',
'/home/runner/work/tauri-mobile/tauri-mobile/tsconfig.json'
]
error when starting dev server:
TSConfckParseError: failed to resolve "extends":"@tsconfig/svelte/tsconfig.json" in /home/runner/work/tauri-mobile/tauri-mobile/tauri/tooling/cli/templates/plugin/with-api/examples/svelte-app/tsconfig.json
at resolveExtends (file:///home/runner/work/tauri-mobile/tauri-mobile/node_modules/tsconfck/dist/index.js:459:9)
at parseExtends (file:///home/runner/work/tauri-mobile/tauri-mobile/node_modules/tsconfck/dist/index.js:432:34)
at Module.parse (file:///home/runner/work/tauri-mobile/tauri-mobile/node_modules/tsconfck/dist/index.js:383:24)
at async Promise.all (index 2)
at async configResolved (file:///home/runner/work/tauri-mobile/tauri-mobile/node_modules/vite-tsconfig-paths/dist/index.mjs:94:9)
at async Promise.all (index 1)
at async resolveConfig (file:///home/runner/work/tauri-mobile/tauri-mobile/node_modules/vite/dist/node/chunks/dep-2285ba4f.js:62801:5)
at async createServer (file:///home/runner/work/tauri-mobile/tauri-mobile/node_modules/vite/dist/node/chunks/dep-2285ba4f.js:61878:20)
at async CAC.<anonymous> (file:///home/runner/work/tauri-mobile/tauri-mobile/node_modules/vite/dist/node/cli.js:729:24)
Error: Process completed with exit code 1.
@Ludea That seems to be a different issue (not a similar error message).
Should I open a new issue to track this ?
@Ludea First, check that @tsconfig/svelte
exists in node_modules. If it does, I'd recommend opening an in issue in tsconfck about it.
The folder doesn't exists into node_modules
Then it's not an issue with this plugin or tsconfck
.
@aleclarson sorry for the delay.
please find the rep : https://github.com/janakg/tsconfig-path-lib-path-issue
Just switch between version 3.6.0 and 4.0.3 of vite-tsconfig-paths , currently it works only in 3.6.0. Also, i don't know how to get the debug log working in this setup
As I have mentioned before this is via electron-vite (it is a thin wrapper library on vite for ease of use for electron apps)
Thanks for the reproduction. No estimates on when I'll be able to take a look though. Hopefully someone else will step in and investigate!
sure, thanks for the update. we will stick to 3.6.0 for now.
I believe that this bug is introduced by this commit:
https://github.com/aleclarson/vite-tsconfig-paths/commit/2361b2ec9f7241ec5f7be77d12092767e68e89e5
Since this commit, this plugin doesn't resolve any import path when the importer is not a descanter of the tsconfig file specified by project
field.
How can we fix this? I can contribute a PR about this.
If anyone wants to investigate this, I've set up a test case. I couldn't reproduce the reported issue, so it may already be fixed. I suggest you try editing that test case to match your scenario as best as possible (while keeping it minimal). If you can reproduce a failure, open a PR with the changes you've made to the test case. Thanks!
v3.6.0 works for a module outside the root, but v4 fails.
example:
tsconfig::