-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Change config prerender.force
to prerender.onError
#2007
Change config prerender.force
to prerender.onError
#2007
Conversation
🦋 Changeset detectedLatest commit: c6f5a10 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
eacff40
to
a49af69
Compare
3599432
to
d90b018
Compare
All set. Thanks @benmccann! |
Lgtm. I left a handful of minor comments. I really like the idea of using a function to give the user more control and stole the idea for another PR #2008 |
73bfcc8
to
a31d066
Compare
@benmccann , in this final pass, I took a little more liberty with the names of those properties ( Additionally, on the types front, I created local references for types that are used more than once (or are especially long) near the top of the file. They can be inlined if that is more desirable, but I feel that things are more readable this way. |
fixes sveltejs#1940 - Changing from `force` to `onError` gives a somewhat more descriptive name to the option. - Using the strings "fail" and "continue" further clarifies what the option does. - Providing your own function to deal with an error allows for fine-tuning which errors fail the build and which do not. The original ticket suggested that the custom function return a boolean, but after seeing the implementation of the error handler in svelteKit, I thought it more fitting to just allow it the exact same API: throw if you want the build to fail.
This commit can be reverted for the 1.0 release. It is purely here for ease of transition from `force` to `onError`.
a31d066
to
c6f5a10
Compare
…ePath * 'master' of https://github.com/sveltejs/kit: (85 commits) [chore] minor simplification of `parse_body` (sveltejs#2043) Version Packages (next) (sveltejs#2026) [chore] deduplicate config types (sveltejs#2030) [chore] remove invalid css declaration (sveltejs#2038) [fix] correctly pass Vite options in preview mode (sveltejs#2036) [feat] Ignore adapter build files (sveltejs#1924) [chore] Upgrade Rollup Don't check external links on prerender (sveltejs#1679) Version Packages (next) (sveltejs#2017) [chore] convert remaining type aliases (sveltejs#2018) [feat] explicitly set compilerOptions.hydratable to config.kit.hydrate (sveltejs#2024) [feat] More powerful and configurable rendering options (sveltejs#2008) [chore] typecheck example (sveltejs#2019) Change config `prerender.force` to `prerender.onError` (sveltejs#2007) [chore] prefer interfaces to types (sveltejs#2010) [docs] minor wording improvement in migration guide (sveltejs#2006) [chore] test debugging improvements [docs] fix typo (sveltejs#2003) [chore] use @ts-expect-error instead of @ts-ignore (sveltejs#1999) Version Packages (next) (sveltejs#1996) ...
fixes #1940
Essentially, we are doing this:
force
toonError
gives a somewhat more descriptivename to the option.
option does.
fine-tuning which errors fail the build and which do not.
The original ticket suggested that the custom function return a boolean,
but after seeing the implementation of the error handler in svelteKit, I
thought it more fitting to just allow it the exact same API: throw if
you want the build to fail.
Teaching the new option via error message:
This PR also adds a failing option check for using the old
force
property, and gives you the proper value to use in its place as well. This should help when people version bump to the latest build.Examples of various acceptable options, and the output when a link is broken
The new handler function option
Throw to fail
Anything but throwing will continue the build
The old behavior via the new settings
fail
continue
Before submitting the PR, please make sure you do the following
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0