Skip to content

Using with /app directory requires env "__NEXT_PRIVATE_PREBUNDLED_REACT=next" #4

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

Open
danigb opened this issue May 29, 2023 · 4 comments

Comments

@danigb
Copy link

danigb commented May 29, 2023

Thanks a lot for this package! ⭐ Simplifies a lot the some dev work πŸ™Œ

While I use this package without problem in some projects, when using "next": "13.4.4" with new app router I get this error:
Screenshot 2023-05-29 at 22 39 17

@TobiasMelen
Copy link
Owner

Thank you for reporting in @danigb, I'll look into it as soon as possible.
I take it this is reproducible by creating a new Next project and simply using the app directory?
Did you try setting the environment value __NEXT_PRIVATE_PREBUNDLED_REACT=next as mentioned here vercel/next.js#49169 (comment)?

@TobiasMelen
Copy link
Owner

I'll take the heart as the issue is indeed solved by the environment variable. Looks like Next requires features not necessary available in React with this error showing up in various scenarios, custom servers being one of them. It works to set this env variable in the module code. I'll need to do some research/testing if this causes side-effects.

For now the recommendation is to set __NEXT_PRIVATE_PREBUNDLED_REACT=next in the your app environment through .env file or similar.

@danigb
Copy link
Author

danigb commented May 31, 2023

πŸ‘ Indeed, this works perfectly. Thanks a lot @TobiasMelen

@danigb danigb closed this as completed May 31, 2023
@TobiasMelen
Copy link
Owner

I'll actually re-open this, this should ideally be fixed from next-dev-https, and keeping the issue open makes the temporary fix easier to find by others.

@TobiasMelen TobiasMelen reopened this Jun 1, 2023
@TobiasMelen TobiasMelen pinned this issue Jun 1, 2023
@TobiasMelen TobiasMelen changed the title Seems to be broken in last nextjs version Using with /app directory requires env "__NEXT_PRIVATE_PREBUNDLED_REACT=next" Jun 1, 2023
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

No branches or pull requests

2 participants