Skip to content

Watcher ignore configuration is confusing #716

@sagikazarmark

Description

@sagikazarmark

Version

2.5.0

Platform

darwin

What steps will reproduce the bug?

  1. Create a directory you want to ignore (eg. .devenv)
  2. Follow the documentation to ignore it from the file watcher
  3. The directory doesn't get ignored (in my case it leads to some issues, see below)

For reference, this is the initial configuration I tried:

import lume from "lume/mod.ts";

const site = lume({
    watcher: {
        ignore: [
            ".devenv",
            ".direnv",

            "./.devenv",
            "./.direnv",
        ],
    },
});

site.ignore(".devenv", ".direnv");

export default site;

To make things even more confusing, the watcher ignore config and the site ignore config does not seem to be in sync (which was my initial assumption).

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

The file watcher should ignore said directories.

What do you see instead?

The file watcher entering the directories I want to exclude have two consequences in my case:

These directories contain a lot of files which means starting Lume takes a lot of time.

It also failed to start due to a broken link in those directories:

error: Uncaught (in worker "") (in promise) NotFound: No such file or directory (os error 2): stat '/Users/mark/Projects/sagikazarmark/sagikazarmark.com/.direnv/flake-inputs/8p8giar71b6aqddqkjckzhirwvjnf02x-source/tests/functional/lang/symlink-resolution/broken'
    const info = Deno.statSync(src);
                      ^
    at Object.statSync (ext:deno_fs/30_fs.js:415:3)
    at FS.#walkLink (https://deno.land/x/lume@v2.5.0/core/fs.ts:167:23)
    at FS.#walkFs (https://deno.land/x/lume@v2.5.0/core/fs.ts:141:23)
    at FS.#walkFs (https://deno.land/x/lume@v2.5.0/core/fs.ts:160:21)
    at FS.#walkFs (https://deno.land/x/lume@v2.5.0/core/fs.ts:160:21)
    at FS.#walkFs (https://deno.land/x/lume@v2.5.0/core/fs.ts:160:21)
    at FS.#walkFs (https://deno.land/x/lume@v2.5.0/core/fs.ts:160:21)
    at FS.#walkLink (https://deno.land/x/lume@v2.5.0/core/fs.ts:181:19)
    at FS.#walkFs (https://deno.land/x/lume@v2.5.0/core/fs.ts:141:23)
    at FS.#walkFs (https://deno.land/x/lume@v2.5.0/core/fs.ts:160:21)
error: Uncaught (in promise) Error: Unhandled error in child worker.
    at Worker.#pollControl (ext:runtime/11_workers.js:204:19)
    at eventLoopTick (ext:core/01_core.js:175:7)

Additional information

After some debugging I managed to get the configuration work:

import lume from "lume/mod.ts";

const site = lume({
    // src: "src",
    watcher: {
        ignore: [
            "/.devenv",
            "/.direnv",
        ],
    },
});

site.ignore(".devenv", ".direnv");

export default site;

Adding a leading slash to the path seems to have done the trick. There is no mention of that in the configuration though.


I use Nix with direnv and devenv to manage Deno, hence those two directories.

I also figured out I could just move the source directory somewhere else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions