Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextConfig is not correctly implemented #1685

Closed
3 tasks done
sovetski opened this issue Jan 27, 2025 · 3 comments
Closed
3 tasks done

NextConfig is not correctly implemented #1685

sovetski opened this issue Jan 27, 2025 · 3 comments
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@sovetski
Copy link

Description

Hi,

I previously created a discussion for this, all related informations are there: #1683

On this issue I added the reproduction URL

Verifications

Mandatory reproduction URL

https://codesandbox.io/p/github/sovetski/next-intl-bug-repro-app-router/main?import=true

Reproduction description

Steps to reproduce:

  1. Go the URL that I provided (or clone from here: https://github.com/sovetski/next-intl-bug-repro-app-router)
  2. The next-intl is disabled by default (commented), so go on yourlocaldomain/en/only-dev you will see that:

Image

  1. Now put back all next-intl code which are commented:

in next.config.ts:

comment export default nextConfig;

uncomment export default withNextIntl(nextConfig);

in layout.tsx:

uncomment all next-intl related part (there is 4-5 lines to uncomment not many)

uncomment next-intl related codes in page.tsx and only-dev/page.dev.tsx

  1. Restart the dev environment

  2. Try to go again yourlocaldomain/en/only-dev, now you will have 404 error

Expected behaviour

Nextjs config must work with or without next-intl. Next-intl should not impact inital Nextjs config

@sovetski sovetski added bug Something isn't working unconfirmed Needs triage. labels Jan 27, 2025
@amannn
Copy link
Owner

amannn commented Jan 27, 2025

Hey, maybe we had a misunderstanding—this is not a bug. You need to pass a NextConfig to withNextIntl. In your example, nextConfig is not a NextConfig but a function that returns one.

You can fix it like this:

export default (phase: string) => {
  const nextConfig = {};
  return withNextIntl(nextConfig);
};

@sovetski
Copy link
Author

Thank you @amannn you are right, it worked better with your suggestion, just before closing this issue let me try to reproduce it on the real project this evening, it will probably work too but who knows, I will come back to close it. Thank you again

@sovetski
Copy link
Author

I confirm that it works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants