Skip to content

Commit

Permalink
fix: Use fs.watch instead of chokidar
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Nov 19, 2024
1 parent 9ea117c commit c8eb4ad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion examples/example-app-router/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"locale": "{locale, select, de {🇩🇪 Deutsch} en {🇺🇸 English} other {Unbekannt}}"
},
"Manifest": {
"description": "",
"name": ""
},
"Navigation": {
Expand Down
1 change: 0 additions & 1 deletion packages/next-intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
],
"dependencies": {
"@formatjs/intl-localematcher": "^0.5.4",
"chokidar": "^4.0.1",
"negotiator": "^1.0.0",
"use-intl": "workspace:^"
},
Expand Down
11 changes: 5 additions & 6 deletions packages/next-intl/src/plugin/createMessagesDeclaration.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fs from 'fs';
import path from 'path';
import {watch} from 'chokidar';
import {throwError} from './utils.tsx';

function runOnce(fn: () => void) {
Expand Down Expand Up @@ -44,14 +43,14 @@ export default function createMessagesDeclaration(messagesPath: string) {
}

function startWatching(messagesPath: string) {
const watcher = watch(messagesPath);

watcher.on('change', () => {
compileDeclaration(messagesPath, true);
const watcher = fs.watch(messagesPath, (eventType) => {
if (eventType === 'change') {
compileDeclaration(messagesPath, true);
}
});

process.on('exit', () => {
void watcher.close();
watcher.close();
});
}

Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c8eb4ad

Please sign in to comment.