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): produce correct next.config.js file for production server #15824

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Mar 22, 2023

This PR fixes an issue where the generated next.config.js file errors out due to with-nx.js referencing relative paths that do no exist.

For reference, the reason we previously used a compiled version of with-nx.js rather than @nrwl/next/plugins/with-nx is because @nrwl/next installs development packages (e.g. Cypress, Webpack, etc.) that bloated the built artifact. See: #12150

This fix has two components:

  1. Move dependencies on @nrwl/cypress, @nrwl/jest, and @nrwl/webpack. from packages/next/package.json into ensurePackage whenever they are used by generators. This change addresses the package size issue.
  2. Remove the compiled version of with-nx.js and use the normal plugin again. This requires a check on the "phase" so that webpack and eslint configurations are only added when doing builds. By checking the phase, we no longer need access to Nx graph since everything has already been compiled into .next..

Current Behavior

Production build cannot run

Expected Behavior

Production build can run

Related Issue(s)

Fixes #15796

@vercel
Copy link

vercel bot commented Mar 22, 2023

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

1 Ignored Deployment
Name Status Preview Comments Updated
nx-dev ⬜️ Ignored (Inspect) Mar 22, 2023 at 5:35PM (UTC)

@jaysoo jaysoo force-pushed the fix/nextjs-remove-inlined-with-nx branch from ba98e5d to 658311f Compare March 22, 2023 15:00
@jaysoo jaysoo force-pushed the fix/nextjs-remove-inlined-with-nx branch 6 times, most recently from 021614d to 51d972f Compare March 22, 2023 16:38
@jaysoo jaysoo marked this pull request as ready for review March 22, 2023 17:03
@jaysoo jaysoo requested a review from xiongemi as a code owner March 22, 2023 17:03
@jaysoo jaysoo force-pushed the fix/nextjs-remove-inlined-with-nx branch from 51d972f to cdd3192 Compare March 22, 2023 17:34
@jaysoo jaysoo merged commit c7e49c5 into nrwl:master Mar 22, 2023
@jaysoo jaysoo deleted the fix/nextjs-remove-inlined-with-nx branch March 22, 2023 18:03
FrozenPandaz pushed a commit that referenced this pull request Mar 22, 2023
FrozenPandaz pushed a commit that referenced this pull request Mar 23, 2023
@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 Mar 27, 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.

next.js build is broken since 15.8.7
2 participants