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

fix(nextjs): enable Next.js 13.4 support #16819

Merged
merged 1 commit into from
May 5, 2023
Merged

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented May 5, 2023

Adds a missing environment variable needed to override react and react-dom to use the once bundled into Next.js itself. Note: This will not be needed once we invoke Next.js CLI directly.

Current Behavior

Expected Behavior

Related Issue(s)

Fixes #16692

@vercel
Copy link

vercel bot commented May 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 5, 2023 5:22pm

Copy link

@ruslanguns ruslanguns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if closed Merged PRs are revisited but I leaved you a comment in a bug I found.

forNextVersion('>=13.4.0', () => {
process.env['__NEXT_PRIVATE_PREBUNDLED_REACT'] =
// Not in Next 13.3 or earlier, so need to access config via string
_nextConfig.experimental['serverActions'] ? 'experimental' : 'next';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaysoo If serverActions is not specified on the experimental object, then it will throw an error because of undefined.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I had the same error as @ruslanguns. It should be first checked if experimental object exists in the config, something like _nextConfig.experimental && _nextConfig.experimental['serverActions']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpnolte just dropped a PR with your suggested fix #16846

ruslanguns added a commit to ruslanguns/nx that referenced this pull request May 7, 2023
This commit addresses a bug introduced in the PR nrwl#16819, which caused
a TypeError when running NextJS 13.4 with the '_nextConfig.experimental' object missing the
'serverActions' property. The fix involves adding checks to ensure that both the
'_nextConfig.experimental' object and 'serverActions' property are defined before attempting to
access them. If 'serverActions' is undefined, the code defaults to using 'next'.

closed 16845
ruslanguns added a commit to ruslanguns/nx that referenced this pull request May 8, 2023
This commit addresses a bug introduced in the PR nrwl#16819, which caused
a TypeError when running NextJS 13.4 with the '_nextConfig.experimental' object missing the
'serverActions' property. The fix involves adding checks to ensure that both the
'_nextConfig.experimental' object and 'serverActions' property are defined before attempting to
access them. If 'serverActions' is undefined, the code defaults to using 'next'.

closed 16845
@aryobenholzner
Copy link

it seems #15796 is still an issue when enabling app directory

@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server.edge' is not defined by "exports"
5 participants