sveltejs / kit

web development, streamlined
https://kit.svelte.dev
MIT License
18.22k stars 1.85k forks source link

Changeable lib/server folder #12021

Open AndreiSoroka opened 4 months ago

AndreiSoroka commented 4 months ago

Describe the problem

  1. https://kit.svelte.dev/docs/project-structure
  2. https://github.com/sveltejs/kit/blob/main/packages/kit/src/exports/vite/graph_analysis/index.js#L37

During documentation and code, you can't change server folder

image

Describe the proposed solution

Make a solution to provide configuration

For example, I want to change the folder to

my-project/
├ src/
│ ├ lib/
│ │ └ [your lib files]
│ │    └ server/
│ │      └ [your server-only lib files]

Like each lib can have server folder

Alternatives considered

No response

Importance

would make my life easier

Additional Information

I use FSD methodology with SvelteKit, and want to make ./sever folder as a segment

At the moment Svelte is not friendly to FSD

FSD: https://feature-sliced.design/docs/get-started/overview

AndreiSoroka commented 4 months ago

Workaround from discord:

https://kit.svelte.dev/docs/server-only-modules#your-modules

use .server.ts extension