mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #202] next-intl: createNextIntlPlugin fails without next installed #49
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#49
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @southpolesteve on GitHub (Feb 28, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/202
Problem
next-intl'screateNextIntlPlugin(the standard way to configure next-intl innext.config.ts) internally tries to detect the installed Next.js version. In vinext projects wherenextisn't installed as a real package, this throws:The config loading fails silently, the webpack alias (
next-intl/config-> user'si18n/request.ts) never gets registered, and at runtime the app crashes with:Context
PR #196 adds
extractWebpackAliases, which correctly extracts webpackresolve.aliasentries fromnext.configplugins. The mechanism works. The problem is upstream:createNextIntlPlugincrashes before it can set up the webpack function.Current workaround
Users can set the webpack alias manually in
next.config.tsinstead of usingcreateNextIntlPlugin:This is what the test fixture uses (see
tests/fixtures/ecosystem/next-intl/next.config.ts).Possible solutions
Shim
next/package.jsonso thatcreateNextIntlPlugin's version check succeeds. This is the least invasive fix, vinext already shims manynext/*imports.Catch and retry config loading when the webpack function extraction fails due to a missing
nextpackage, and provide a helpful error message pointing users to the manual alias workaround.Auto-detect
next-intlinpackage.jsondependencies and register thenext-intl/configalias automatically (probe fori18n/request.{ts,tsx,js,jsx}in standard locations). This would make next-intl work zero-config without needingcreateNextIntlPluginat all.Engage with next-intl upstream to make the version check optional or graceful when
nextisn't found, so the plugin works in alternative frameworks.Additional note:
requestLocaleis always undefinedSeparately from the config loading issue,
getRequestConfig'srequestLocaleparameter is alwaysundefinedin vinext. In Next.js, this is populated by next-intl's middleware. Users need to explicitly pass{ locale }togetMessages()and use client components withNextIntlClientProviderfor locale-aware rendering. Server-sideuseTranslationswithout explicit locale passing will always fall back to the default locale.This is tracked implicitly by the "partial" support status for next-intl but is worth calling out for anyone working on deeper integration.