-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Is there a way to exclude specific pages from production build #8974
Comments
This comment has been minimized.
This comment has been minimized.
This has been heavily debated in previous issues which can be found via search. At present time, we're not exploring adding an option to remove specific pages from the production build. tl;dr if they aren't pages, remove them from the You may be able to find more help for your unique use case on Spectrum. |
I just pass by but wonder about this too since one of my page is It also shows when running If I try to access it, e.g. at
Maybe this is not a big deal but it may be good if we can exclude the hidden pages from the production build. Note: I tried |
In my case, I need to build the site twice for authenticated reasons. On one hand, there's unathed pages, and on another hand there's authed pages. It's extremely difficult to manage this with a single export without making them entirely different sites. Though I haven't been able to figure out how to build the site twice, where there's a clean separation using different |
Meaning, no matter what I do with |
wrote up how this could be added to Next.js in this discussion: #29514 please chime in with feedback/support! |
I use During the build and export, the admin directory is skipped. I do not know if this will work for SSR pages.
|
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
I know this was discussed in #2332 but I have a slightly different use case which I'd like to share.
Feature request
Ignore certain pages under pages/ at build time.
Is your feature request related to a problem? Please describe.
I'm using the same MDX pages (content) in two projects. One handles MDX at runtime and let's me catch malformed MDX/JSX at runtime. The other project uses the MDX files directly at buildtime, but now it fails on a page I was using to demonstrate error handling.
Describe the solution you'd like
Could there be a
next.config.js
key, likepageExtensions
but instead to prevent certain pages (by regex or simple array) from being built? MaybeignorePages
?Describe alternatives you've considered
Neither the HOC approach nor the 404 trick would help in the case of (known) malformed pages.
Additional context
Note that I'm not looking to put otherwise useful files under
pages/
but I want to handle the case of known malformed files.Back to my two-project example, you could think of one as the Admin and the other as the Public site. Files from Admin are automatically copied to Public using dat, but it would apply to any kind of sync.
The text was updated successfully, but these errors were encountered: