Modularize SvelteKit
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
A popular point of feedback from the other maintainers is that SvelteKit is not as modular as we had hoped we might make it at the beginning of the project
Describe the proposed solution
We could possible split out a few different pieces:
- The core router without file system support
- The file system router depending on the core router
- Kit itself with Vite integration. We've already split out
vite-plugin-svelteand I'm not sure there's much more that makes sense to split out there - Put optional features in plugins (e.g. AMP https://github.com/sveltejs/kit/issues/2603)
I'd written a bit about this in https://github.com/sveltejs/rfcs/pull/36 originally for Sapper and tried to update the proposal a bit for SvelteKit though further updates may be needed
I don't know whether it'd be possible to make the router implementation pluggable, but I think it'd be a cool goal. I also think it'd be nice to remove any globals which would help for testing (right now you can mostly only write tests if you use Jest and mock the globals) and allow you to have multiple router instances (@pngwn has long asked for microfrontend support and while that's not something I'm overly familiar with I could imagine multiple routers getting pulled in)
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked Svelte RFC and mapping the current router, file-system router, Kit/Vite integration, and optional features described in the issue. Define the module boundaries and testing approach before changing code; done means the proposed pieces can be separated without globals blocking tests and the resulting architecture supports the stated plugin and multiple-router goals.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100