Skip to content

Commit

Permalink
fix(nextjs): enable Next.js 13.4 support (#16819)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo authored May 5, 2023
1 parent 5b94159 commit 8861515
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/next/plugins/with-nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ function withNx(
_nextConfig = {} as WithNxOptions,
context: WithNxContext = getWithNxContext()
): NextConfigFn {
// If this is not set user will see compile errors in Next.js 13.4.
// See: https://github.com/nrwl/nx/issues/16692, https://github.com/vercel/next.js/issues/49169
// TODO(jack): Remove this once Nx is refactored to invoke CLI directly.
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';
});

return async (phase: string) => {
const { PHASE_PRODUCTION_SERVER } = await import('next/constants');
if (phase === PHASE_PRODUCTION_SERVER) {
Expand Down

1 comment on commit 8861515

@vercel
Copy link

@vercel vercel bot commented on 8861515 May 5, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.