Skip to content

Eleventy stops watching for new files (reproducible) #2340

Closed
@genemars

Description

@genemars

Describe the bug

This is different than #2270 . Eleventy watcher stops watching any newly added files under the following circumstances.

To Reproduce

  1. Create a new project as explained in Eleventy docs:
    https://www.11ty.dev/docs/getting-started/

  2. Add a test.js file in the root of the new project:

const fs = require('fs');
const mkdirp = require('mkdirp');
const ts = new Date().getTime();
mkdirp.sync('./source/content/blog/post-' + ts);
fs.writeFileSync('./source/content/blog/post-'+ts+'/index.md', 'Hi there!');
if (!fs.existsSync('./source/content/blog/index.liquid')) {
  fs.writeFileSync('./source/content/blog/index.liquid', 'hello');
}
  1. Start the dev server:
npx @11ty/eleventy --serve
  1. In another terminal run the script for two times (or more)
node test.js
  1. Eleventy will build correctly every time the script is run
  2. Remove the test folder: rm -rf source/content/blog
  3. Run the script again for two times: Eleventy will only rebuild the first time and it will ignore any subsequently added file.

Expected behavior
Should detect new files and rebuild.

Environment:

  • OS and Version: Linux
  • Eleventy Version 1.0.1 and 2.0.x as well

The test script and steps described above are a simplification of what happens in the following video. After deleting the
blog section, adding it again, only the first post is built.

Peek.23-04-2022.10-22.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: --serve restartChanges to projects shouldn’t need to restart dev serverfeature: ⏱️ watchDoesn’t affect primary builds, only subsequent builds during --watch and --serve

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions