Replies: 1 comment 4 replies
-
You can use this method with pageExtensions, #51891 (comment), just make sure to get the pageExtensions correct, you'd need sometihng like You need to tweak it a bit though, but it should work. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
NextConfig
to exclude a folder and/or a route group during the build processNon-Goals
No response
Background
I would like to use Payload CMS to build a website that has two flavours. One flavour is the "full app" including the Payload admin portal which requires a full Next.js server and is intended only for internal use. The other flavour is a statically built version of the website that does not include an admin portal and can be easily hosted with just a CDN. The problem is that this requires excluding everything Payload-related (i.e. everything under
src/app/(payload)
) during a static build.I have managed to get this working at https://github.com/Gerharddc/payload-ssg-example using a custom build script that temporarily renames the
(payload)
folder to_(payload)
during the build so that it gets ignored during static builds. Even though this technically works, it is obviously not a great solution.Proposal
Currently my
next.config.mjs
looks like this:It would be great if there were an option named something like "excludeRouteGroups" in
NextConfig
so that I could just addexcludeRouteGroups: ["payload"]
during static builds so that I don't have to do the silly folder rename step.Beta Was this translation helpful? Give feedback.
All reactions