-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
autogenerated type import path fails during build on nextjs 13 app directory, not finding layout file #14558
Comments
Bump, having the same issue, with a nested
|
Hello, we experiencing the same issue. Currently, the dev/prod builds are affected.
|
I came across this behavior as well. The issue seems to be related to Next.js adding the Workaround "targets": {
"build": {
"executor": "@nrwl/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"root": "apps/next-app",
- "outputPath": "dist/apps/next-app"
+ "outputPath": "apps/next-app/dist"
},
}, |
@Fetten thank you for the workaround! Have you tried it for standalone outputs? |
@AndriiTsok, No, haven't tried it yet in standalone mode. |
It looks like NX is not supporting NextJS 13, since no one in the entire world can use Does anyone know if NX is planning to support Next 13 any time soon or is it back to Next 12 for production? |
It seems to build in [email protected]. However, it's putting the build output on |
Ok, it seems like [email protected] breaks with nx: |
I've made a temporary fix for [email protected], which is still compatible with NX in case anyone wants to try out appdir. "pnpm": {
"overrides": {
"next": "npm:@ian-patches/[email protected]"
}
} |
Opened a PR in next to fix it. Also released a patch for 13.2.4: "pnpm": {
"overrides": {
"next": "npm:@ian-patches/[email protected]"
}
} |
This one worked for me as a hotfix. I hope nx + next will resolve this soon. |
Also encountering this issue, should have checked GH earlier instead of waisting hours of headaches :) |
we need a permanent solution instead of playing with project.json. |
The plugin was failing in NX monorepos due to a wrong import path. #44363, nrwl/nx#14558 ``` nx build my-next > nx run my-next:build:production warn - You have enabled experimental feature (appDir) in next.config.js. warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk. info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback info - Creating an optimized production build info - Compiled successfully info - Skipping linting info - Checking validity of types ..Failed to compile. Type error: Cannot find module '../../../../app/layout' or its corresponding type declarations. —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— > NX Ran target build for project my-next (2s) ✖ 1/1 failed ``` --------- Co-authored-by: Ian Serpa <[email protected]> Co-authored-by: Shu Ding <[email protected]>
Hi all! Can you try with |
[email protected] solves the issue for me. |
This has been fixed in the latest versions of Nx and Next.js. Please note the I'm closing this. If you still face issues related to this using the latest versions, feel free to leave a comment or open a new issue with updated details. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
Expected Behavior
Build successfully without errors.
Github Repo
No response
Steps to Reproduce
All I need to do to reproduces it is to enable app dir:
in a NextJS project.
While running
nx serve my-next
, the appDir works fine,when running
nx build my-next
, the error above happens.I can see the file generated during the build process that is dealing with types has a wrong path:
Nx Report
Failure Logs
No response
Additional Information
Just a very basic @nrwl/next project, with
appDir
enabled, fails on build.The text was updated successfully, but these errors were encountered: