Skip to content

fix: always add @sveltejs/kit to noExternal for ssr build #9242

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

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Feb 28, 2023

fixes #9234

FYI @benmccann @Rich-Harris we always need @sveltejs/kit to be part of noExternal. Else the build output contains something like

import { redirect } from '@sveltejs/kit';

// some compiled code..
  redirect(307, '..');

while the output code also contains the SvelteKit server runtime, including their own definitions for Redirect etc classes, which means all instanceof checks fail.

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. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@dummdidumm dummdidumm merged commit 450097f into master Feb 28, 2023
@dummdidumm dummdidumm deleted the fix-noexternal branch February 28, 2023 10:16
@github-actions github-actions bot mentioned this pull request Feb 28, 2023
dummdidumm added a commit that referenced this pull request Apr 3, 2025
We previously used a grotesque hack that would ensure the HttpError etc classes would be the same between what Vite imports via its transformation toolchain and what you get from a regular node import.

Turns out we don't need that anymore - since #9242 SvelteKit is guaranteed to always be loaded through the Vite toolchain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redirect in hooks.servers.ts throw an Error
2 participants