TobiasMelen / next-dev-https

Next Development server Https/QR support
MIT License
25 stars 4 forks source link

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

Open danigb opened 1 year ago

danigb commented 1 year ago

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 commented 1 year ago

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 https://github.com/vercel/next.js/issues/49169#issuecomment-1562599903?

TobiasMelen commented 1 year ago

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 commented 1 year ago

👍 Indeed, this works perfectly. Thanks a lot @TobiasMelen

TobiasMelen commented 1 year ago

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.