-
-
Notifications
You must be signed in to change notification settings - Fork 112
Description
Describe the bug
We experienced some head-scratching confusion when our SvelteKit app suddenly started complaining about missing route files. After some commit and VSCode extension bisecting, we came across a bizarre behaviour that was causing SvelteKit's internal tsconfig.json to be overridden (seemingly by the Vitest VSCode extension) when a combination of criteria are met.
Specifically, various paths in compilerOptions.paths and compilerOptions.rootDirs get updated, whenever any package.json file is modified in any way, replacing those paths with invalid paths to another package (that happens to also have Vite config) in the same monorepo. This happens seemingly "magically", even when no dev or other scripts are running.
Reproduction
Repro, along with demo steps, can be found in this repo:
- https://stackblitz.com/edit/sveltekit-vitest-tsconfig-hijack?file=README.md (edit: moved to Stackblitz)
This repro uses SvelteKit for demoing purposes. I believe this issue is not specific to SvelteKit, however.
The issue goes away as soon as any one of the following steps are taken:
- disable this VSCode extension, or
- remove the root
vitest.workspace.jsfile, or - remove the
vite.config.tsfile of sibling packages, or - uninstall the
vitestpackage at the root package
Weirder still, most of these steps will also "reset"/restore the hijacked tsconfig.json file to its original, expected state.
Output
[INFO 2:36:55 PM] [API] Vitest process 33901 closed successfully
[INFO 2:36:55 PM] [API] Running Vitest: v1.5.0 (vitest.workspace.js)
[INFO 2:36:55 PM] [API] Starting Vitest process with Node.js: /path/to/library/pnpm/node
[INFO 2:36:55 PM] [API] Vitest process 33977 createdVersion
v0.8.4
Validations
- Check that you are using the latest version of the extension
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
