Skip to content

Commit

Permalink
fix: don't patch solution project in ts plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlyu123 committed Dec 5, 2024
1 parent a3a6393 commit 171fab2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/typescript-plugin/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@ export function hasNodeModule(startPath: string, module: string) {
}

export function isSvelteProject(project: ts.server.Project) {
// internal api, the way to check requires checking the files config in tsconfig.json
// so we can't reimplement it without reading the tsconfig.json again
// The solution project is mostly just a container we don't need to patch it
// and having any files in this project cause TSServer to send config error while it originally won't
if ((project as any).isSolution?.()) {
return false;
}

const projectDirectory = getProjectDirectory(project);
if (projectDirectory) {
return hasNodeModule(projectDirectory, 'svelte');
Expand Down

0 comments on commit 171fab2

Please sign in to comment.