HoudiniGraphql/houdini

Houdini-svelte crashes the svelte LSP in vscode

Closed this issue · 0 comments

Describe the bug

For a while now I've been having random Svelte LSP crashes in vscode. I'm not sure when it started but I think it was around when the vscode plugin was getting support for svelte 5, so I thought it was just a weird bug there.
However today I properly took a look at the output log and found that there's some exception getting thrown somewhere within the houdini-svelte plugin.

the error seems to be getting caused on line 112 here, where it's complaining that filepath.includes isn't a function...

filesystem.statSync = function (filepath: string, options: Parameters<filesystem.StatSyncFn>[1]) {
if (!filepath.includes('routes') || !path.basename(filepath).startsWith('+')) {
return _statSync(filepath, options as any)
}

I haven't had time yet to figure out a reproduction but I'll get on this when I have some more time to dig into it.

output:

[Info  - 5:56:34 PM] Connection to server got closed. Server will restart.
true
Initialize language server at  file:///c%3A/<REDACTED>/<REDACTED>
Initialize new ts service at  c:/<REDACTED>/<REDACTED>/tsconfig.json
Trying to load configs for c:/<REDACTED>/<REDACTED>
Loaded config at  c:\<REDACTED>\<REDACTED>\svelte.config.js
SnapshotManager File Statistics:
Project files: 580
Svelte files: 330
From node_modules: 0
Total: 580
Preprocessing failed
[Failed to load PostCSS config: Failed to load PostCSS config (searchPath: c:/<REDACTED>/<REDACTED>): [TypeError] filepath.includes is not a function
TypeError: filepath.includes is not a function
    at filesystem.statSync (file:///c:/<REDACTED>/<REDACTED>/node_modules/houdini-svelte/build/plugin-esm/index.js:172473:17)
    at fileExists (node:internal/modules/esm/resolve:149:13)
    at legacyMainResolve (node:internal/modules/esm/resolve:168:9)
    at packageResolve (node:internal/modules/esm/resolve:850:14)
    at moduleResolve (node:internal/modules/esm/resolve:912:20)
    at defaultResolve (node:internal/modules/esm/resolve:1105:11)
    at nextResolve (node:internal/modules/esm/loader:166:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:840:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:429:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)] {
  __source: 'Style'
}
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Failed to load PostCSS config: Failed to load PostCSS config (searchPath: c:/<REDACTED>/<REDACTED>): [TypeError] filepath.includes is not a function
TypeError: filepath.includes is not a function
    at filesystem.statSync (file:///c:/<REDACTED>/<REDACTED>/node_modules/houdini-svelte/build/plugin-esm/index.js:172473:17)
    at fileExists (node:internal/modules/esm/resolve:149:13)
    at legacyMainResolve (node:internal/modules/esm/resolve:168:9)
    at packageResolve (node:internal/modules/esm/resolve:850:14)
    at moduleResolve (node:internal/modules/esm/resolve:912:20)
    at defaultResolve (node:internal/modules/esm/resolve:1105:11)
    at nextResolve (node:internal/modules/esm/loader:166:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:840:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:429:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)] {
  __source: 'Style'
}

Node.js v18.18.2
[Error - 5:56:43 PM] The Svelte server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Reproduction

No response