Skip to content

Commit

Permalink
Throw when watching for changes when watch mode disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Nov 14, 2024
1 parent 9042a5c commit 3385fc9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react-router-dev/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,11 @@ export async function createConfigLoader({
return {
getConfig,
onChange: (handler: ChangeHandler) => {
changeHandlers.push(handler);
if (!watch) {
throw new Error(
"onChange is not supported when watch mode is disabled"
);
}

if (!fsWatcher) {
fsWatcher = chokidar.watch(
Expand Down

0 comments on commit 3385fc9

Please sign in to comment.