Skip to content

Update chokidar usage to support v4 (glob patterns removal) #138

@Hugoer

Description

@Hugoer

The current FE Build implementation relies on glob patterns when creating watchers with chokidar, for example:

const chokidar = require('chokidar')
const sassPattern = path.join(config.general.sourcesPath, `**/*.${config.general.sourceKey}.scss`)
const watcher = chokidar.watch(sassPattern, {
    ignoreInitial: true
})

However, this behavior is no longer supported in chokidar v4. According to the official changelog in npm:

v4 (Sep 2024): remove glob support and bundled fsevents. Decrease dependency count from 13 to 1. Rewrite in typescript. Bumps minimum node.js requirement to v14+.

This change was introduced when upgrading the dependency in this PR:
#137

As a result, watchers using glob patterns may stop working correctly when using chokidar v4.

The official documentation suggests replacing glob-based watchers with:

// v4
chok.watch('.', {
  ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'), // only watch js files
});
chok.watch('./directory');

Expected behaviour:

Update the FE Build watcher implementation to avoid passing glob patterns directly to chokidar.watch() and adopt one of the supported approaches for chokidar v4.

This will ensure compatibility with the current dependency version and prevent watcher failures in future updates.

Metadata

Metadata

Assignees

Labels

blockerRelease blockerbugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions