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

[fix] fallback should still be generated when prerender is disabled #2128

Merged
merged 5 commits into from
Aug 11, 2021
Merged

[fix] fallback should still be generated when prerender is disabled #2128

merged 5 commits into from
Aug 11, 2021

Conversation

Theo-Steiner
Copy link
Contributor

@Theo-Steiner Theo-Steiner commented Aug 7, 2021

Fixes #1588

The bug described in #1588 is about the adapter-static in SPA-mode (-> fallback set) not outputting the {fallback}.html file into the build directory when config.kit.prerender.enabled is set to false.

This PR is an easy fix for this behavior, as config.kit.prerender.enabled can be ignored in the SPA mode. It bypasses the check for config.kit.prerender.enabled in the getter for the prerender function by modifying the expression to be true by default when a fallback is defined.

You can see that this fixes the bug on the branch bug-demonstration on my fork of sveltejs/kit.

For this,

  1. clone the repo git clone https://github.com/Theo-Steiner/kit.git
  2. run checkout bug-demonstration, pnpm i, pnpm build
  3. navigate to cd examples/kit-bug
  4. execute pnpm build and do ls build and you will see that index.html was in fact created!
  • Ideally, include a test that fails without this PR but passes with it.

I did not include a test, since I honestly don't know how I would test for this behavior.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpx changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Aug 7, 2021

🦋 Changeset detected

Latest commit: 598748a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@benmccann

This comment has been minimized.

@Theo-Steiner
Copy link
Contributor Author

Theo-Steiner commented Aug 10, 2021

@benmccann I made the crawling for loop conditional as you suggested! Thank's for the input =)

@benmccann benmccann changed the title Fix fallback not being output to build dir when prerender disabled [fix] fallback should still be generated when prerender is disabled Aug 10, 2021
@benmccann
Copy link
Member

@Theo-Steiner lgtm, but the tests are failing and will need to be updated. I added a changeset, so you might want to do a git pull first to pull that change down locally before updating the code

@benmccann benmccann merged commit c3ca3fb into sveltejs:master Aug 11, 2021
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 this pull request may close these issues.

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