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: fix the publish directory for next.js #5502

Merged
merged 4 commits into from
Sep 12, 2024

Conversation

lukasholzer
Copy link
Contributor

@lukasholzer lukasholzer commented Feb 2, 2024

🎉 Thanks for submitting a pull request! 🎉

Summary

For NX Monorepos, the detection of a Next.js app is wrong as it does not point to the .next folder. Instead, it just points to the top-level dist folder.

For example: dist/packages/website would currently be the output, but this is wrong. It must be dist/packages/website/.next as we always need to point to the .next folder.

This will lead to "broken" sites when using the create new site flow on netlify with an nx workspace and Next.js. So, users need to fix the publish directory in the build settings manually.

CleanShot 2024-09-12 at 10 06 14

which fails with:

CleanShot 2024-09-12 at 10 08 42


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures
    we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures
    your code follows our style guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@lukasholzer lukasholzer marked this pull request as ready for review February 2, 2024 13:39
@lukasholzer lukasholzer requested review from a team as code owners February 2, 2024 13:39
Copy link
Contributor

@Skn0tt Skn0tt left a comment

Choose a reason for hiding this comment

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

Looks wonderful, loving all the tests we have on this!

@github-actions github-actions bot added the stale label Apr 5, 2024
@mrstork
Copy link
Contributor

mrstork commented May 24, 2024

This seems like an easy win, is it still relevant? Shall we get this merged?

@github-actions github-actions bot removed the stale label Jul 26, 2024
@serhalp
Copy link
Contributor

serhalp commented Sep 11, 2024

@lukasholzer could you explain in the PR description what the bug is and how this fixes it? I'm not understanding what's different about next.js here

@Skn0tt
Copy link
Contributor

Skn0tt commented Sep 11, 2024

I'd be curious as well!

@lukasholzer
Copy link
Contributor Author

@serhalp and @Skn0tt I've updated the description ;)

@pieh
Copy link
Contributor

pieh commented Sep 12, 2024

And to answer why this is different for Next specifically - it's because of NX ecosystem around frameworks

For Next.js they have quite a bit of tooling build around it and for Next.js they keep original Next.js distDir nested under NX "dist dir" ( https://github.com/nrwl/nx/blob/b6140d459020847818b738ddc17e52c069657893/packages/next/plugins/with-nx.ts#L206-L209 )

But for example for Astro - they don't really have a plugin like that - instead application generator/bootstrapper/scaffolder ( https://www.npmjs.com/package/@nxtensions/astro ) will define output dir to something like dist/apps/<app-name> (this might need a bit more looking into if that is correct, but regardless - it seems like we need to approach NX with each framework individually so targetting next specifically here seems fine to me and we shouldn't try to generalize it for any framework

@lukasholzer lukasholzer merged commit b0740ba into main Sep 12, 2024
37 checks passed
@lukasholzer lukasholzer deleted the fix/fix-publish-directory-with-next branch September 12, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants