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

Disabling SSR doesn't work #10168

Closed
s1nistr4 opened this issue Jun 16, 2023 · 5 comments
Closed

Disabling SSR doesn't work #10168

s1nistr4 opened this issue Jun 16, 2023 · 5 comments

Comments

@s1nistr4
Copy link

Describe the bug

Putting export const ssr = false in src/+layout.js doesn't disable SSR, even though the docs say so. After running npm run build it still generates server code. There are many reasons to not use it such as using your own API written in something other than Node, you could roll 2 servers but it's a huge pain and there should be working support for writing single page apps

Reproduction

.

Logs

No response

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
    Memory: 3.53 GB / 10.95 GB
  Binaries:
    Node: 20.0.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.7.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1848.0), Chromium (114.0.1823.43)
    Internet Explorer: 11.0.22621.1

Severity

blocking all usage of SvelteKit

Additional Information

No response

@dummdidumm
Copy link
Member

Please provide a reproduction repository to clarify what you mean. export const ssr = false does turn off server side rendering. But it does not prevent you from writing code that needs a server - but you can also write it in such a way that you get a simple SPA with one index.html that loads all the JS. More info here: https://kit.svelte.dev/docs/single-page-apps

@Conduitry
Copy link
Member

Closing due to inactivity.

@Conduitry Conduitry closed this as not planned Won't fix, can't repro, duplicate, stale Jul 2, 2023
@guradia
Copy link

guradia commented Oct 30, 2023

I have to second the OP's problem.
The reproduction is simple (i use TypeScript and Skeleton and all testing options):

bun create svelte@latest my-app
cd my-app
bun install
echo "export const ssr = false;" > src/routes/+layout.js
bun run build

As result, the whole doubled build-process for the Server runs and .svelte-kit/output/server gets populated.

Using pnpm instead of bun, doesn't change anything.
Adding the adapter-static too, does not change anything apart from then pushing all into build/.

Originally i came from a skeleton.dev starter. Which does have a +layout.svelte. Which is then confusing in where to put the export const ssr = false; as stated here: https://kit.svelte.dev/docs/single-page-apps.

And that started a hunt through stackoverflow, issues and PR, with changing errors the build process presented ("ssr ignorend", "config option doesn't exits" ...)

@minhui-foxtel
Copy link

I'm facing the same issue as @guradia mentioned.

@justindthomas
Copy link

Seeing the same thing here. I need my build process to be conditional (selectable between adapter-node and adapter-static) and was worried about the export const ssr = false requirement in +layout.js. But I guess it doesn't matter since it doesn't seem to change anything.

I also tried putting +layout.js at the actual root (one level above routes) since that's what the documentation says. Doesn't seem to matter.

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

No branches or pull requests

6 participants