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

prerender=true and ssr=false mix build wrong #10983

Closed
shynome opened this issue Nov 5, 2023 · 2 comments · Fixed by #10988
Closed

prerender=true and ssr=false mix build wrong #10983

shynome opened this issue Nov 5, 2023 · 2 comments · Fixed by #10988
Labels
bug Something isn't working

Comments

@shynome
Copy link

shynome commented Nov 5, 2023

Describe the bug

I build a site with static page and dynamic page both, this problem has broken dynamic pages

Reproduction

# select Skeleton project
npm create svelte@latest test
cd test
npm i
echo 'export const prerender = true;export const ssr = false;export async function load() {};' > src/routes/+layout.server.ts
npm run build
npm run preview -- --open 
# got 500, expect Skeleton default page

Logs

No response

System Info

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics
    Memory: 17.72 GB / 30.64 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 18.17.1 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.6.7 - /usr/bin/npm
    pnpm: 7.18.0 - /usr/bin/pnpm
    bun: 1.0.2 - ~/.bun/bin/bun
  Browsers:
    Chrome: 119.0.6045.105
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.1 
    @sveltejs/adapter-static: ^2.0.3 => 2.0.3 
    @sveltejs/kit: ^1.5.0 => 1.27.3 
    svelte: ^3.54.0 => 3.59.2 
    vite: ^4.0.0 => 4.5.0

Severity

blocking all usage of SvelteKit

Additional Information

I use +layout.server.ts to provide { navs: [ {name:"home",link: "/"} ] } for breadcrumb nav

src/routes/
├── +page.svelte
├── +layout.server.ts     # { navs: [ {name:"home",link: "/"] }
└── user
    ├── +layout.server.ts # { navs: [ {name:"home",link: "/"}, {name:"user center",link: "/user"}] }
    └── +page.svelte
@shynome
Copy link
Author

shynome commented Nov 6, 2023

miss generate /__data.json

@shynome shynome changed the title prerender=true and ssr=false mix build failed prerender=true and ssr=false mix build wrong Nov 6, 2023
@shynome
Copy link
Author

shynome commented Nov 6, 2023

#10332 the similar problem

@shynome shynome closed this as completed Nov 6, 2023
@shynome shynome reopened this Nov 6, 2023
@eltigerchino eltigerchino added the bug Something isn't working label Nov 6, 2023
dummdidumm pushed a commit that referenced this issue Nov 9, 2023
fixes #10983

This PR adds a check to see if we're prerendering and SSR is turned off to avoid responding with CSR only too early. With this check in place, the should_prerender check can now be reached and generate the __data.json file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants