sveltejs / sveltejs/kit

Bundle Components into 1 File

Open
#12,944 2 comments 0 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 a route that is getting a lot of traffic.
  • That route uses many components and when compiled each of these components get compiled into 1 file each.
  • I use vercel to deploy my projects and vercel caches automatically on the edge network.
  • A lot of traffic + A lot of components = A huge bill
  • I can solve it hardcoding every component into my +page.svelte but clearly I don't want to do that.

For reference using Svelte 5 + SvelteKit.

Describe the proposed solution

I would need a way to compile every component into 1 file and if it is called from /+page.svelte with a lot of traffic use that big file. Or maybe even some docs on how to compile svelte into ES Module (I have found some, but they are all using rollup or really old versions of svelte). None of them uses sveltekit.

WebComponents are simply nasty and I don't want to deal with them. (Unless you tell me that they are the only way I won't use them).

Importance

i cannot use svelte without it

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 with the reported Svelte 5 + SvelteKit route and its +page.svelte entry point, then inspect the generated component files for a high-traffic route. Clarify whether the requested outcome is a SvelteKit bundling feature or documentation for an existing ES module workflow. Done would require a decided scope and a reproducible, supported approach for controlling the generated output.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.