-
-
Notifications
You must be signed in to change notification settings - Fork 344
Description
Description
It seems like using the --turbo flag with the Nextjs dev server is currently not possible. There appears to be a mismatch with how the config file is resolved at different points in the dev server operation.
If I start the Next dev server without --turbo and the following config, everything works great:
/**
* This works for Webpack
*
* But NOT for starting the Turbo dev server
*/
const withNextIntl = createNextIntlPlugin(
'i18n/request.ts',
);But this does NOT work with turbo:
Error: [next-intl] Could not find i18n config at i18n/request.ts, please provide a valid path.Second, I tried setting up another config file path, starting from src/ this time:
/**
* This works for STARTING the Turbo dev server
*
* But this will throw an error in layout.tsx when loading localhost:3000
*/
const withNextIntl = createNextIntlPlugin(
'src/i18n/request.ts',
);The dev server starts just fine, but once I load the project in the browser it throws an error in layout.tsx:
✓ Compiled / in 1295ms
⨯ Error: Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-router
at RootLayout (src/app/layout.tsx:20:31)
18 | children: React.ReactNode
19 | }) {
> 20 | const locale = await getLocale();This could be related to how I structure my projects. All Nextjs frontend code is contained within the src/ dir. Check package.json in the repro repository to see the scripts I am using to start Next.
Verifications
- I've verified that the problem I'm experiencing isn't covered in the docs.
- I've searched for similar, existing issues on GitHub and Stack Overflow.
- I've compared my app to a working example to look for differences.
Mandatory reproduction URL
https://github.com/joshverd/next-intl-bug-repro
Reproduction description
- Clone repro repository
- Run
npm i - Open
src/next.config.ts - Run
npm run dev-turbo
Expected behaviour
I expect the dev server to 1) start properly and 2) render my layout.tsx and page.tsx files correctly.