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

feat: adapter-static throws buildtime error when !config.kit.prerender.default && !adapter.fallback #5562

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eleven-buckets-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-static': patch
---

[breaking] Throws when correctly configured to run as a static site of a SPA
4 changes: 2 additions & 2 deletions packages/adapter-static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default function (options) {

async adapt(builder) {
if (!options?.fallback && !builder.config.kit.prerender.default) {
builder.log.warn(
'You should set `config.kit.prerender.default` to `true` if no fallback is specified'
throw Error(
'adapter-static requires `config.kit.prerender.default` to be `true` unless you set the `fallback: true` option to create a single-page app. See https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode for more information'
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import adapter from '../../../../adapter-static/index.js';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter(),
adapter: adapter({ fallback: '200.html' }),

prerender: {
enabled: false
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.