Skip to content

Is there a way to exclude specific pages from production build #8974

@millette

Description

@millette

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, like pageExtensions but instead to prevent certain pages (by regex or simple array) from being built? Maybe ignorePages?

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions