question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

adapter-static `fallback` page not generated when `prerender.enabled` is `false`

See original GitHub issue

Describe the bug Using the adapter static in “SPA” configuration doesn’t output any html entry point even though the build completes without errors. All other bundled assets are created as far as i can tell. /build contains

/_app
  |--/assets
  |--/chunks
  |--/pages
  |--...misc.js
_redirects

Logs Build completes successfully with logs ending in

vite v2.3.3 building SSR bundle for production...
✓ 38 modules transformed.
.svelte-kit/output/server/app.js   396.41kb

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-static
  ✔ done
✨  Done in 3.72s.

To Reproduce svelte.config.js

import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  // Consult https://github.com/sveltejs/svelte-preprocess
  // for more information about preprocessors
  preprocess: preprocess(),
  kit: {
    // hydrate the <div id="svelte"> element in src/app.html
    target: '#svelte',
    adapter: adapter({
      fallback: "index.html"
    }),
    prerender: {
      enabled: false
    },
    ssr: false,
    vite: {
      ssr: {
        noExternal: ["chart.js"]
      },
    }
  }
};

export default config;

To help us help you, if you’ve found a bug please consider the following:

  • If possible, we recommend creating a small repo that illustrates the problem.
  • Reproductions should be small, self-contained, correct examples – http://sscce.org.

Occasionally, this won’t be possible, and that’s fine – we still appreciate you raising the issue. But please understand that Svelte is run by unpaid volunteers in their free time, and issues that follow these instructions will get fixed faster.

Expected behavior Entrypoint index html should be generated in the root of the build dir

Stacktraces N/A

Information about your SvelteKit Installation:

Diagnostics

System: OS: macOS 11.1 CPU: (8) arm64 Apple M1 Memory: 520.03 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.1.0 - ~/.nvm/versions/node/v16.1.0/bin/node Yarn: 1.22.10 - /opt/homebrew/bin/yarn npm: 7.11.2 - ~/.nvm/versions/node/v16.1.0/bin/npm Browsers: Brave Browser: 91.1.25.68 Firefox: 88.0.1 Safari: 14.0.2 npmPackages: @sveltejs/kit: ^1.0.0-next.110 => 1.0.0-next.110 svelte: ^3.34.0 => 3.38.2

  • Adapter-Static

Severity How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of SvelteKit entirely?

This is medium high severity, we are unable to deploy our svelte kit SPA, although the dev server works fine

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
harvey-kcommented, Aug 8, 2021

@benmccann Adding the following to packages\adapter-static\test\apps\spa\svelte.config.js reproduces this issue.

  prerender: {
    enabled: false
  },
  ssr: false,

PR #2128 makes the tests pass again.

Would the above config changes make a more representative “spa mode” test or would you prefer an separate test app from prerendered and spa be created?

0reactions
benmccanncommented, Aug 5, 2021

Can anyone provide a repo that reproduces this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

@sveltejs/adapter-static - npm
(Setting config.kit.prerender.enabled to false also has this effect, but would prevent the fallback page from being generated.).
Read more >
Page options • Docs • SvelteKit
Pages with actions cannot be prerendered, because a server must be able to handle the action POST requests. Prerender and ssrpermalink. If you...
Read more >
@sveltejs/adapter-static | Yarn - Package Manager
Adapter for SvelteKit apps that prerenders your entire site as a collection of static files. If you'd like to prerender only some pages,...
Read more >
How to use get parameter on sveltekit when use adapter-static?
I get error message this when build. Cannot access url.searchParams on a page with prerendering ...
Read more >
Learn How SvelteKit Works As a Framework - Joy of Code
If you want you can even use adapter-static to generate a single-page application if you specify a fallback page. svelte.config.js. Copy. import adapter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found