Skip to content

Commit

Permalink
fix: don't patch solution project in ts plugin (#2617)
Browse files Browse the repository at this point in the history
part of #2612
  • Loading branch information
jasonlyu123 authored Dec 9, 2024
1 parent 02db54d commit 89c001b
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 89c001b

Please sign in to comment.