Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/pages/docs/workflows/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const withNextIntl = createNextIntlPlugin({
// ...
```

With this setup in place, you'll see a new declaration file generated in your `messages` directory once you run `next dev` or `next build`:
With this setup in place, you'll see a new declaration file generated in your `messages` directory once you run `next dev`, `next build` or `next typegen`:

```diff
messages/en.json
Expand Down
12 changes: 12 additions & 0 deletions packages/next-intl/src/plugin/createMessagesDeclaration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ function runOnce(fn: () => void) {
export default function createMessagesDeclaration(
messagesPaths: Array<string>
) {
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));

if (!shouldRun) {
return;
}

// Next.js can call the Next.js config multiple
// times - ensure we only run once.
runOnce(() => {
Expand Down