Skip to content

Unable to exclude directories from being watched with --tsconfig #2797

@Corrl

Description

@Corrl

Describe the bug

When running svelte-check in watch mode I run into an issue

Getting Svelte diagnostics...

failed to load config from /Users/.../vite.config.ts
Preprocessing failed
Error: spawn EBADF
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:762:9)
    at ensureServiceIsRunning (/Users/.../node_modules/esbuild/lib/main.js:1982:29)

which I tracked down to be related to the chokidar from version 4 with projects including a lot of files on macOS paulmillr/chokidar#1385

Both downgrading to [email protected] with as [email protected] dependency or removing some directories containing a lot of files from the project solve the issue. So I would like to exclude these directories from being watched. The docs say

--ignore <paths>
Only has an effect when used in conjunction with --no-tsconfig. When used in conjunction with --tsconfig, this will only have effect on the files watched, not on the files that are diagnosed, which is then determined by the tsconfig.json.

Which is contradictory. Adding the --ignore flag gives the error

> svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch --ignore="build"

Error: Invalid svelte-check CLI args: `--ignore` only has an effect when using `--no-tsconfig`

that is caused by this line

throwError('`--ignore` only has an effect when using `--no-tsconfig`');
that was added with #2453 to solve #1074 so the docs don't seem to be up to date.

If the --ignore flag can't be used in conjunction with --tsconfig, how can I prevent the directories from being watched without disabling the checking of .js / .ts files? Excluding the directories in tsconfig.json doesn't seem to have an effect on that.

Reproduction

Use --ignore flag in cunjuntion with --tsconfig

Expected behaviour

Exclude ignored directories from being watched

System Info

macOS 13.7.2
svelte-check 4.2.2

Which package is the issue about?

svelte-check

Additional Information, eg. Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions