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

next-intl v3.x.x breaks my code #632

Closed
jim-king-2000 opened this issue Nov 15, 2023 · 3 comments
Closed

next-intl v3.x.x breaks my code #632

jim-king-2000 opened this issue Nov 15, 2023 · 3 comments
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@jim-king-2000
Copy link

Description

./state/translate.jsx:4:0
Module not found: Package path ./link is not exported from package D:\WorkHouse\cache-hit\jujiuipcappui\node_modules\next-intl (see exports field in D:\WorkHouse\cache-hit\jujiuipcappui\node_modules\next-intl\package.json)
  2 |
  3 | import { useTranslations } from 'next-intl';
> 4 | import Link from 'next-intl/link';
  5 | import { useRouter, usePathname } from 'next-intl/client';
  6 |
  7 | export default Link;

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./app/[locale]/nextui/(main)/device/page.jsx

Mandatory reproduction URL (CodeSandbox or GitHub repository)

https://github.com/Cache-Hit-Shanghai/jujiuipcappui

Reproduction description

When we update next-intl from v2.22.1 to v3.0.2, we get the error above.

Expected behaviour

If Link is removed from next-intl/link, would you please give us a substitution?

@jim-king-2000 jim-king-2000 added bug Something isn't working unconfirmed Needs triage. labels Nov 15, 2023
@jim-king-2000
Copy link
Author

I change my code to:

import { createSharedPathnamesNavigation } from 'next-intl/navigation';

export const locales = ['en', 'cn'];

const { Link, redirect, usePathname, useRouter } = createSharedPathnamesNavigation({ locales });

export default Link;
export { useRouter, usePathname };

But the error message chagnes to :

 ⨯ node_modules\next\dist\client\components\static-generation-bailout.js (33:14) @ staticGenerationBailout
 ⨯ Error: Page with `dynamic = "error"` couldn't be rendered statically because it used `headers`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering
    at stringify (<anonymous>)
digest: "1656766269"
null

What is the resolution?

@amannn
Copy link
Owner

amannn commented Nov 15, 2023

Yep, as you've noticed createSharedPathnamesNavigation is the replacement.

In regard to your second point about static rendering: This has been addressed in #633 ([email protected]). There is however a change necessary that was missing in the release notes previously, please see Changes to NextIntlClientProvider.

Hope this helps!

@amannn amannn closed this as completed Nov 15, 2023
@jim-king-2000
Copy link
Author

Get it work. Thanks.

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