Skip to content

Commit c8eb4ad

Browse files
committed
fix: Use fs.watch instead of chokidar
1 parent 9ea117c commit c8eb4ad

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

examples/example-app-router/messages/de.json

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"locale": "{locale, select, de {🇩🇪 Deutsch} en {🇺🇸 English} other {Unbekannt}}"
1616
},
1717
"Manifest": {
18-
"description": "",
1918
"name": ""
2019
},
2120
"Navigation": {

packages/next-intl/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@
111111
],
112112
"dependencies": {
113113
"@formatjs/intl-localematcher": "^0.5.4",
114-
"chokidar": "^4.0.1",
115114
"negotiator": "^1.0.0",
116115
"use-intl": "workspace:^"
117116
},

packages/next-intl/src/plugin/createMessagesDeclaration.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fs from 'fs';
22
import path from 'path';
3-
import {watch} from 'chokidar';
43
import {throwError} from './utils.tsx';
54

65
function runOnce(fn: () => void) {
@@ -44,14 +43,14 @@ export default function createMessagesDeclaration(messagesPath: string) {
4443
}
4544

4645
function startWatching(messagesPath: string) {
47-
const watcher = watch(messagesPath);
48-
49-
watcher.on('change', () => {
50-
compileDeclaration(messagesPath, true);
46+
const watcher = fs.watch(messagesPath, (eventType) => {
47+
if (eventType === 'change') {
48+
compileDeclaration(messagesPath, true);
49+
}
5150
});
5251

5352
process.on('exit', () => {
54-
void watcher.close();
53+
watcher.close();
5554
});
5655
}
5756

pnpm-lock.yaml

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)