From 8ae8057e98e21bce26d6961070999de5c32a0921 Mon Sep 17 00:00:00 2001 From: Jan Amann Date: Thu, 4 Sep 2025 10:06:02 +0200 Subject: [PATCH] fix: Ensure messages declaration continues working in `next dev` for upcoming `next@15.5.1` --- .../src/plugin/createMessagesDeclaration.tsx | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/next-intl/src/plugin/createMessagesDeclaration.tsx b/packages/next-intl/src/plugin/createMessagesDeclaration.tsx index 6ecffbadd..a574ba095 100644 --- a/packages/next-intl/src/plugin/createMessagesDeclaration.tsx +++ b/packages/next-intl/src/plugin/createMessagesDeclaration.tsx @@ -14,15 +14,24 @@ function runOnce(fn: () => void) { export default function createMessagesDeclaration( messagesPaths: Array ) { - const shouldRun = [ - 'dev', - 'build', - 'typegen' - // Note: The 'lint' task doesn't consult the - // Next.js config, so we can't detect it here. - ].some((arg) => process.argv.includes(arg)); + // Instead of running _only_ in certain cases, it's + // safer to _avoid_ running for certain known cases. + // https://github.com/amannn/next-intl/issues/2006 + const shouldBailOut = [ + 'info', + 'start' - if (!shouldRun) { + // Note: These commands don't consult the + // Next.js config, so we can't detect them here. + // - telemetry + // - lint + // + // What remains are: + // - dev + // - build + // - typegen + ].some((arg) => process.argv.includes(arg)); + if (shouldBailOut) { return; }