Skip to content

Modularize SvelteKit #2611

Open
Open
@benmccann

Description

@benmccann

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-svelte and I'm not sure there's much more that makes sense to split out there
  • Put optional features in plugins (e.g. AMP Move amp support to a plugin #2603)

I'd written a bit about this in sveltejs/rfcs#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature / enhancementNew feature or requestsize:largesignificant feature with tricky design questions and multi-day implementation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions