Skip to content

feat: Automatic tree-shaking of messages (experimental)#2252

Draft
amannn wants to merge 38 commits into
mainfrom
feat/tree-shaking-messages
Draft

feat: Automatic tree-shaking of messages (experimental)#2252
amannn wants to merge 38 commits into
mainfrom
feat/tree-shaking-messages

Conversation

@amannn

@amannn amannn commented Feb 10, 2026

Copy link
Copy Markdown
Owner

Resolves #1 (but very, very WIP to experiment for now)

TODO

  • Implementation
    • Turbopack: emit/collect vercel/next.js#91100
    • Compiler orchestration
      • Manifest loader only has a single compile pass. Can we do something similar to integrate with extraction loader?
      • Offload more to SWC / Rust? Maybe a single SWC plugin that returns all analysis (useExtracted, deps, 'use client', …)
      • Can we emit extractor and tree shaking result at same time to avoid redundant work?
    • API
      • Should we add a lower-level API? The usage is slightly misleading, because not everything below the provider is collected, but everything that is imported into the module. E.g. import manifest from 'next-intl/client-manifest?path=optional' with {type: 'macro'} would be another candidate, but not sure if the verbosity is worth it (or if it's even clearer). It's surely more explicit, but useExtracted is already implicitly subject to AST transforms—so not sure if we need to do it here.
      • Pages Router?
      • Any way to easily cut off server messages without more work?
    • Edge cases
      • Solution for error.tsx
      • fix: Barrel file tree-shaking #2262
      • Check Next.js docs thoroughly for other use cases to consider
      • Configurable tsconfig? (ref) — forward this
      • Test what happens where there are syntax errors.
    • Rework implementation / deslop
    • Performance
  • Tests
    • Can we reuse this for an integration test?
  • First user testing
  •  Docs
    • A playground for toggling layout boundaries?

@vercel

vercel Bot commented Feb 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next-intl-docs Ready Ready Preview, Comment Feb 23, 2026 4:28pm
next-intl-example-app-router Ready Ready Preview, Comment Feb 23, 2026 4:28pm
next-intl-example-app-router-without-i18n-routing Ready Ready Preview, Comment Feb 23, 2026 4:28pm

Request Review

amannn and others added 10 commits February 10, 2026 16:33
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
@amannn amannn changed the title feat: Tree-shaking of messages feat: Automatic tree-shaking of messages Feb 11, 2026
amannn and others added 8 commits February 11, 2026 18:18
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
amannn and others added 10 commits February 12, 2026 17:30
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…sages

# Conflicts:
#	packages/next-intl/package.json
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
@amannn amannn changed the title feat: Automatic tree-shaking of messages feat: Automatic tree-shaking of messages (experimental) Feb 25, 2026
@amannn amannn mentioned this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatic tree-shaking of messages

1 participant