Skip to content

Commit

Permalink
fix(nextjs): Nightly failures since yarn eagerly reads imports (#16522)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham committed Apr 24, 2023
1 parent aeb5950 commit 4dea8b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next/plugins/with-nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
import * as path from 'path';
import type { NextConfig } from 'next';
import { PHASE_PRODUCTION_SERVER } from 'next/constants';
import type { NextConfigFn } from '../src/utils/config';
import type { NextBuildBuilderOptions } from '../src/utils/types';
import type { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
Expand Down Expand Up @@ -155,6 +154,7 @@ function withNx(
context: WithNxContext = getWithNxContext()
): NextConfigFn {
return async (phase: string) => {
const { PHASE_PRODUCTION_SERVER } = await import('next/constants');
if (phase === PHASE_PRODUCTION_SERVER) {
// If we are running an already built production server, just return the configuration.
const { nx, ...validNextConfig } = _nextConfig;
Expand Down

1 comment on commit 4dea8b7

@vercel
Copy link

@vercel vercel bot commented on 4dea8b7 Apr 24, 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-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.