sveltejs / sveltejs/kit

Exclude pages from build

Open
#7,193 3 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

I have some devonly pages that I use to showcase project components and do general testing with.
I use

export const ssr = import.meta.env.DEV;
export const csr = import.meta.env.DEV;

to hide them from public view, but from my build output it seems that they still get built.
I haven't found a way for the pages to be excluded from the build.

Describe the proposed solution

Being able to exclude pages/layout groups from the build output with something like

export const exclude = true;

would be very nice.

Alternatives considered

No response

Importance

nice to have

Additional Information

Thank you for your consideration.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing SvelteKit's build handling for pages and layout groups, focusing on how the build output is generated. Define how an exclude setting should behave for pages and groups, then verify that excluded routes do not appear in the build output while normal routes still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.