Skip to content

File watcher glob workaround doesn't activate for chokidar v5 #1115

@mikerockett

Description

@mikerockett

Octane Version

2.17.1

Laravel Version

13

PHP Version

8.5

What server type are you using?

Swoole

Server Version

6.0

Database Driver & Version

No response

Description

The fix for #962 (glob support removed in chokidar v4) only checks version.startsWith('4.') in bin/file-watcher.cjs line 8. Chokidar v5 also removed glob support, so the path extraction and ignored filter never activate when chokidar v5 is installed.

This means wildcard watch paths like app-modules/**/*.php or config/**/*.php are passed as raw globs to chokidar v5, which silently ignores them. Only plain directory paths (e.g. app, routes) work.

The version check should use a semver comparison (>= 4) rather than a string prefix check.

Steps To Reproduce

  1. Install chokidar v5 (npm install chokidar@^5.0.0)
  2. Keep the default config/octane.php watch paths (which include config/**/*.php, database/**/*.php, etc.)
  3. Run octane:start --watch
  4. Modify a file in config/ - no reload
  5. Modify a file in app/ (no glob) - reload works
  6. Change config/**/*.php to config in the watch array - reload now works for config changes

Suggested Fix

In bin/file-watcher.cjs, change:

const chokidarVersion4 = require(chokidarPackagePath).version.startsWith('4.');

To something like:

const chokidarMajor = parseInt(require(chokidarPackagePath).version.split('.')[0], 10);
const chokidarVersion4 = chokidarMajor >= 4;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions