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): refactor how webpack config is loaded with nextjs #15650

Merged
merged 4 commits into from
Mar 15, 2023

Conversation

ndcunningham
Copy link
Contributor

@ndcunningham ndcunningham commented Mar 13, 2023

Currently, there is a breaking change that exists after you upgrade your next dependency to next:13.2.x

This happened because we would pass the webpack configuration to the nextJs's build function which is no longer supported

What does the mean for new / existing workspaces

  • No changes are required

TODO

  • Ensure imported shared libs compiles without errors
  • Add e2e tests for nextjs workspaces
  • Rename withNxnew function
  • Remove webpack config from build.impl

Fixes: #15214, #13194

@vercel
Copy link

vercel bot commented Mar 13, 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) Visit Preview Mar 15, 2023 at 9:34PM (UTC)

@mandarini
Copy link
Member

Left a comment, then deleted it, because i was testing an issue that is not addressed, sorry!

@ndcunningham ndcunningham marked this pull request as ready for review March 15, 2023 21:55
@ndcunningham ndcunningham changed the title fix(nextjs): move webpack config to withNx from build.impl fix(nextjs): refactor how webpack config is loaded with nextjs Mar 15, 2023
@FrozenPandaz FrozenPandaz merged commit be81405 into nrwl:master Mar 15, 2023
FrozenPandaz pushed a commit that referenced this pull request Mar 15, 2023
Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>

(cherry picked from commit be81405)
@skaneprime
Copy link

Dunno should it be here but when building nextjs app it can't defy path correctly (ig it is next issue But not sure)

 info  - Checking validity of types ..Failed to compile.

../../../dist/apps/web/site/.next/types/app/layout.ts:2:24
Type error: Cannot find module '../../../../../../app/layout' or its corresponding type declarations.

  1 | // File: W:\vault\apps\web\site\app\layout.tsx
> 2 | import * as entry from '../../../../../../app/layout'
    |                        ^
  3 | import type { ResolvingMetadata } from 'next/dist/lib/metadata/types/metadata-interface'
  4 | 
  5 | type TEntry = typeof entry

 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Ran target build for project web-site (10s)

    ×    1/1 failed
    √    0/1 succeeded [0 read from cache]

// File: W:\vault\apps\web\site\app\layout.tsx
import * as entry from '../../../../../../app/layout' 
// path must be ../../../apps/subdir/project-name/app/layout 
// aka this ../../../apps/web/site/app/layout

import type { ResolvingMetadata } from 'next/dist/lib/metadata/types/metadata-interface'

type TEntry = typeof entry

// Check that the entry is a valid entry
...

next.config.js

  typescript: {
    ignoreBuildErrors: true // will solve the issue but this is workaround. 
  },

@ianldgs
Copy link
Contributor

ianldgs commented Mar 16, 2023

@skaneprime that's a known issue: #14558
And yes, it's on nextjs side, I'm planning to make a PR to fix it:
ianldgs/next.js@60f70d5

meeroslav pushed a commit to meeroslav/nx that referenced this pull request Mar 16, 2023
…15650)

Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
@ndcunningham ndcunningham self-assigned this Mar 16, 2023
@ndcunningham ndcunningham deleted the fix/nextjs-13-issue branch March 16, 2023 15:19
@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 21, 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: The @nrwl/next:build executor is incompatible with Next 13.2
5 participants