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

[breaking] add builder.generateFallback(fallback) API #8013

Merged
merged 1 commit into from Dec 9, 2022
Merged

Conversation

Rich-Harris
Copy link
Member

closes #7899. This changes the behaviour around fallback 200.html/404.html pages so that they are only generated when needed (which, in practice, means only in adapter-static).

As a result, no rendering takes place during the build unless prerender.entries is populated.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

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 pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Dec 9, 2022

🦋 Changeset detected

Latest commit: ccb7853

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

This PR includes changesets to release 2 packages
Name Type
@sveltejs/adapter-static Patch
@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

@Rich-Harris Rich-Harris changed the title [breaking] add builder.generateFallback(fallback) API [breaking] add builder.generateFallback(fallback) API Dec 9, 2022
@JordanShurmer
Copy link

JordanShurmer commented Jan 26, 2023

Did something change in recent releases around this behavior?

Specifically, is this claim still true: "no rendering takes place during the build unless prerender.entries is populated."?

When upgrading from 1.0.0 to 1.2.10 our build fails with "Prerendering failed with code 1", and an error saying fetch can't be found within one of our server files. Adding prerender: { entries: [] } does not fix it.

@dummdidumm
Copy link
Member

What error message specifically? Is this #8536 by any chance?

@JordanShurmer
Copy link

No, it doesn't seem like that error. Here's what I am getting:

file:///stuff/.svelte-kit/output/server/chunks/landingPage.js:15
    fetch,
    ^

ReferenceError: fetch is not defined
    at ourClient (file:///stuff/.svelte-kit/output/server/chunks/landingPage.js:15:5)
    at file:///stuff/.svelte-kit/output/server/chunks/landingPage.js:44:16
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async Promise.all (index 1)
    at async file:///stuff/node_modules/.pnpm/@sveltejs+kit@1.2.10_svelte@3.55.1+vite@4.0.4/node_modules/@sveltejs/kit/src/core/postbuild/index.js:61:17
[vite-plugin-sveltekit-compile] Prerendering failed with code 1
error during build:
Error: Prerendering failed with code 1
    at ChildProcess.<anonymous> (file:///stuff/node_modules/.pnpm/@sveltejs+kit@1.2.10_svelte@3.55.1+vite@4.0.4/node_modules/@sveltejs/kit/src/exports/vite/index.js:629:15)
    at ChildProcess.emit (node:events:527:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
 ELIFECYCLE  Command failed with exit code 1.

@JordanShurmer
Copy link

Following up on my question about whether this behavior has changed. For our build, we start seeing the error above when we move from 1.0.12 to 1.0.13

https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fkit%401.0.13

I'll check out what changes were included in this release.

@dummdidumm
Copy link
Member

Might be #8655 then

@JordanShurmer
Copy link

Yes, I just found that issue as well. It does seem to be the same. Things provided by node are no longer available during the pre-render?

I still question why it is even pre-rendering at all though. Any ideas on that @dummdidumm ?

@dummdidumm
Copy link
Member

It's not really prerendering, it's loading the code to analyse it

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

Successfully merging this pull request may close these issues.

Unable to entirely disable prerendering
3 participants