Skip to content

Commit 2bf09ec

Browse files
authored
fix: Ensure messages declaration continues working in next dev for upcoming [email protected] (#2008)
Fixes #2006 Related to #1992 Related to vercel/next.js#82654
1 parent 1de05a2 commit 2bf09ec

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

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

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,24 @@ function runOnce(fn: () => void) {
1414
export default function createMessagesDeclaration(
1515
messagesPaths: Array<string>
1616
) {
17-
const shouldRun = [
18-
'dev',
19-
'build',
20-
'typegen'
21-
// Note: The 'lint' task doesn't consult the
22-
// Next.js config, so we can't detect it here.
23-
].some((arg) => process.argv.includes(arg));
17+
// Instead of running _only_ in certain cases, it's
18+
// safer to _avoid_ running for certain known cases.
19+
// https://github.com/amannn/next-intl/issues/2006
20+
const shouldBailOut = [
21+
'info',
22+
'start'
2423

25-
if (!shouldRun) {
24+
// Note: These commands don't consult the
25+
// Next.js config, so we can't detect them here.
26+
// - telemetry
27+
// - lint
28+
//
29+
// What remains are:
30+
// - dev
31+
// - build
32+
// - typegen
33+
].some((arg) => process.argv.includes(arg));
34+
if (shouldBailOut) {
2635
return;
2736
}
2837

0 commit comments

Comments
 (0)