Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kit builds my project two times even if I disabled ssr #2937

Closed
frederikhors opened this issue Nov 27, 2021 · 5 comments · May be fixed by naiba4/kit#1
Closed

Kit builds my project two times even if I disabled ssr #2937

frederikhors opened this issue Nov 27, 2021 · 5 comments · May be fixed by naiba4/kit#1

Comments

@frederikhors
Copy link
Contributor

frederikhors commented Nov 27, 2021

Describe the bug

I couldn't understand why Kit builds my project two times even if I disabled ssr in svelte.config.cjs:

vite v2.6.14 building for production...
...
vite v2.6.14 building SSR bundle for production...

Reproduction

https://github.com/frederikhors/iss-svelte-kit-tailwind-comments

Logs

> my-app@0.0.1 build
> svelte-kit build

vite v2.6.14 building for production...
✓ 28 modules transformed.
.svelte-kit/output/client/_app/assets/svelte-logo-87df40b8.svg             1.85 KiB
.svelte-kit/output/client/_app/manifest.json                               1.82 KiB
.svelte-kit/output/client/_app/pages/__layout.svelte-57ab7eca.js           4.04 KiB / gzip: 1.79 KiB
.svelte-kit/output/client/_app/error.svelte-0ebcf88e.js                    1.56 KiB / gzip: 0.75 KiB
.svelte-kit/output/client/_app/start-c23624a4.js                           18.75 KiB / gzip: 6.89 KiB
.svelte-kit/output/client/_app/pages/index.svelte-7be39bf6.js              3.62 KiB / gzip: 1.62 KiB
.svelte-kit/output/client/_app/pages/about.svelte-0cea0aea.js              2.29 KiB / gzip: 1.04 KiB
.svelte-kit/output/client/_app/pages/todos/index.svelte-d9cac2e2.js        5.48 KiB / gzip: 2.33 KiB
.svelte-kit/output/client/_app/assets/start-61d1577b.css                   0.16 KiB / gzip: 0.15 KiB
.svelte-kit/output/client/_app/chunks/vendor-836cc791.js                   14.11 KiB / gzip: 6.00 KiB
.svelte-kit/output/client/_app/assets/pages/__layout.svelte-fd9cb797.css   0.28 KiB / gzip: 0.19 KiB
vite v2.6.14 building SSR bundle for production...
✓ 31 modules transformed.
.svelte-kit/output/server/app.js                          0.10 KiB
.svelte-kit/output/server/chunks/app-32bc2016.js          51.76 KiB
.svelte-kit/output/server/chunks/index.json-784727b1.js   0.42 KiB
.svelte-kit/output/server/chunks/_api-e66b1c82.js         0.60 KiB
.svelte-kit/output/server/chunks/_uid_.json-039b6f30.js   0.41 KiB
.svelte-kit/output/server/chunks/__layout-d917862c.js     2.19 KiB
.svelte-kit/output/server/chunks/error-5c3307f4.js        0.75 KiB
.svelte-kit/output/server/chunks/index-b7efcc6a.js        6.08 KiB
.svelte-kit/output/server/chunks/about-950f4908.js        0.96 KiB
.svelte-kit/output/server/chunks/index-3b94195b.js        1.82 KiB

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-static
  ✔ done

System Info

System:
    OS: Windows 10 10.0.19043
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (96.0.1054.29)
  npmPackages:
    @sveltejs/adapter-static: 1.0.0-next.21 => 1.0.0-next.21
    @sveltejs/kit: 1.0.0-next.196 => 1.0.0-next.196
    svelte: 3.44.2 => 3.44.2

Severity

serious, but I can work around it

@Rich-Harris
Copy link
Member

Since there's no more ssr config option (was removed in favour of ssr: false in handle), there's nowhere to turn this off anyway. But even if we could, there needs to be a server somewhere if only to prerender the SPA shell page. It is wasteful to build entry points for pages that aren't going to be server-rendered, but changing that would necessitate design changes that I don't think are justified by slightly shorter build times, so I'm going to close this

@dae
Copy link

dae commented Feb 22, 2024

I've found myself wanting the same thing. We have a desktop app that uses a bunch of svelte pages. I've been investigating a switch to sveltekit+static adaptor, but the build time is a bit painful: around 10 seconds for the client, and another 10 for the server. Being able to shave it by half would be a noticeable improvement.

Why not just use "dev" instead of "build"? When actively working on a page, we would. But the app has its own build system, which builds all oudated components, and for sveltekit we'd need to invoke a build.

If it's practical to cut out the SSR step / approximately halve build time, I would be willing to get my company to sponsor a sveltejs dev who was willing to implement it. If interested, please email d-svelte at ankiweb.net.

@niemyjski
Copy link

I'm in the same boat, I'm never going to use ssr.

@roberrrt-s
Copy link

Same, would just like to have a flag where server build is off, could resort to just SvelteJS with a random router, but I like the SvelteKit structure

@ilyakamens
Copy link

I'm using SvelteKit, but with a Flask backend. I have no use for the server part of SvelteKit; I only want to use the routing. The additional build takes extra time and is noisy (since I don't use it). Please enable us to disable it. IMO the routing and server functionality shouldn't be coupled. It makes SvelteKit less desirable if it's all-or-nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants