Sveltekit project split into separate functions without split: true

I have a fairly big sveltekit project, during local build it gives a total of ~10MB.
The project has about 230 different unique route endpoints.

Since a couple of days the vercel builds resulted in automatic splitting into separate functions for each unique endpoint, thus resulting in about 230 functions.

I searched my whole codebase for the mentions of split in combination with true and false, but found none.

Is there some other mechanic on which the vercel build process decides to split the function into separate functions for each endpoint?
What details, code or config do i need to share for you to better understand why this might be happening all of a sudden?

Eager to learn :wink:

Thank you for your insights!

Hi @jordvisser-gmailcom, welcome to the Vercel Community!

Can you share the package.json and svelte.config.js file here?

It’d be best if you could share your public repo or a minimal reproducible example. That will let us all work together from the same code to figure out what’s going wrong.

1 Like

Hi Anshuman,

Thank you for the quick reply.
With a nights sleep and your first reaction, it took it upon myself to try to figure it out a bit better.

I verified which deployment changed over from single function to single function per endpoint.
It happend during a moment where I was updating npm packages, and verifying against local building and running a preview server (and not testing with vercel preview builds).
With no problems on the local environment the total resulted in 133 package changes from one vercel deployment to the other.
For now I have reverted back to the pnpm-lock.yaml state of the build that had a single functiom and will npm update in single steps until I encounter the problem again, this might take me a while :wink:

I condensed the changes between the lock files in a condensed overview, maybe you recognize a package that might influence the build step in which vite/vercel decides on how to split the build into functions.

The most notable are:


....

## Updated Packages (99)

| Package | Old Version | New Version |
|---------|-------------|-------------|
| ...... | ...... | ...... |
| @sveltejs/adapter-vercel | 5.6.3 | 5.7.0 |
| ...... | ...... | ...... |
....

The whole analyzed diff between the two pnpm-lock.yaml files:

# Package Changes Summary

## Added Packages (33)

| Package | Version |
|---------|----------|
| @asamuzakjp/css-color | 3.1.2 |
| @csstools/color-helpers | 5.0.2 |
| @csstools/css-calc | 2.1.3 |
| @csstools/css-color-parser | 3.0.9 |
| @csstools/css-parser-algorithms | 3.0.4 |
| @csstools/css-tokenizer | 3.0.3 |
| cmdk-sv | 0.0.19 |
| cssstyle | 4.3.0 |
| data-urls | 5.0.0 |
| decimal.js | 10.5.0 |
| define-lazy-prop | 2.0.0 |
| entities | 4.5.0 |
| html-encoding-sniffer | 4.0.0 |
| http-proxy-agent | 7.0.2 |
| iconv-lite | 0.6.3 |
| is-docker | 2.2.1 |
| is-potential-custom-element-name | 1.0.1 |
| is-wsl | 2.2.0 |
| jsdom | 26.1.0 |
| nwsapi | 2.2.20 |
| open | 8.4.2 |
| parse5 | 7.2.1 |
| rollup-plugin-visualizer | 5.14.0 |
| rrweb-cssom | 0.8.0 |
| safer-buffer | 2.1.2 |
| symbol-tree | 3.2.4 |
| tldts | 6.1.86 |
| tldts-core | 6.1.86 |
| tough-cookie | 5.1.2 |
| w3c-xmlserializer | 5.0.0 |
| whatwg-encoding | 3.1.1 |
| whatwg-mimetype | 4.0.0 |
| xml-name-validator | 5.0.0 |

## Removed Packages (0)

No packages were removed.

## Updated Packages (99)

| Package | Old Version | New Version |
|---------|-------------|-------------|
| @emnapi/runtime | 1.3.1 | 1.4.3 |
| @eslint-community/eslint-utils | 4.5.1, 4.6.1 | 4.6.1 |
| @internationalized/date | 3.7.0 | 3.8.0 |
| @melt-ui/svelte | 0.86.4 | 0.76.2, 0.86.6 |
| @opentelemetry/semantic-conventions | 1.28.0, 1.30.0 | 1.28.0, 1.32.0 |
| @rollup/rollup-android-arm-eabi | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-android-arm64 | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-darwin-arm64 | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-darwin-x64 | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-freebsd-arm64 | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-freebsd-x64 | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-arm-gnueabihf | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-arm-musleabihf | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-arm64-gnu | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-arm64-musl | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-loongarch64-gnu | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-powerpc64le-gnu | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-riscv64-gnu | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-riscv64-musl | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-s390x-gnu | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-x64-gnu | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-linux-x64-musl | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-win32-arm64-msvc | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-win32-ia32-msvc | 4.37.0, 4.40.0 | 4.40.0 |
| @rollup/rollup-win32-x64-msvc | 4.37.0, 4.40.0 | 4.40.0 |
| @sentry-internal/browser-utils | 9.9.0 | 9.13.0 |
| @sentry-internal/feedback | 9.9.0 | 9.13.0 |
| @sentry-internal/replay | 9.9.0 | 9.13.0 |
| @sentry-internal/replay-canvas | 9.9.0 | 9.13.0 |
| @sentry/babel-plugin-component-annotate | 3.2.0 | 3.2.4 |
| @sentry/browser | 9.9.0 | 9.13.0 |
| @sentry/bundler-plugin-core | 3.2.0 | 3.2.4 |
| @sentry/cli | 2.41.1 | 2.42.2 |
| @sentry/cli-darwin | 2.41.1 | 2.42.2 |
| @sentry/cli-linux-arm | 2.41.1 | 2.42.2 |
| @sentry/cli-linux-arm64 | 2.41.1 | 2.42.2 |
| @sentry/cli-linux-i686 | 2.41.1 | 2.42.2 |
| @sentry/cli-linux-x64 | 2.41.1 | 2.42.2 |
| @sentry/cli-win32-i686 | 2.41.1 | 2.42.2 |
| @sentry/cli-win32-x64 | 2.41.1 | 2.42.2 |
| @sentry/cloudflare | 9.9.0 | 9.13.0 |
| @sentry/core | 9.9.0 | 9.13.0 |
| @sentry/node | 9.9.0 | 9.13.0 |
| @sentry/opentelemetry | 9.9.0 | 9.13.0 |
| @sentry/svelte | 9.9.0 | 9.13.0 |
| @sentry/sveltekit | 9.9.0 | 9.13.0 |
| @sentry/vite-plugin | 3.2.0 | 3.2.4 |
| @sveltejs/adapter-vercel | 5.6.3 | 5.7.0 |
| @swc/helpers | 0.5.15 | 0.5.17 |
| @tanstack/eslint-plugin-query | 5.68.0 | 5.73.3 |
| @tanstack/query-async-storage-persister | 5.69.0 | 5.74.4 |
| @tanstack/query-core | 5.69.0 | 5.74.4 |
| @tanstack/query-devtools | 5.67.2 | 5.73.3 |
| @tanstack/query-persist-client-core | 5.69.0 | 5.74.4 |
| @tanstack/query-sync-storage-persister | 5.69.0 | 5.74.4 |
| @tanstack/svelte-query | 5.69.0 | 5.74.4 |
| @tanstack/svelte-query-devtools | 5.69.0 | 5.74.4 |
| @tanstack/svelte-query-persist-client | 5.69.0 | 5.74.4 |
| @types/aws-lambda | 8.10.148 | 8.10.149 |
| @types/emscripten | 1.40.0 | 1.40.1 |
| @types/estree | 0.0.39, 1.0.6, 1.0.7 | 0.0.39, 1.0.7 |
| @types/node | 14.18.63, 22.13.13, 22.14.1 | 14.18.63, 22.14.1 |
| @types/webrtc | 0.0.45 | 0.0.46 |
| @typescript-eslint/eslint-plugin | 8.28.0, 8.30.1 | 8.30.1 |
| @typescript-eslint/parser | 8.28.0, 8.30.1 | 8.30.1 |
| @typescript-eslint/scope-manager | 8.28.0, 8.30.1 | 8.30.1 |
| @typescript-eslint/type-utils | 8.28.0, 8.30.1 | 8.30.1 |
| @typescript-eslint/types | 8.28.0, 8.30.1 | 8.30.1 |
| @typescript-eslint/typescript-estree | 8.28.0, 8.30.1 | 8.30.1 |
| @typescript-eslint/utils | 8.28.0, 8.30.1 | 8.30.1 |
| @typescript-eslint/visitor-keys | 8.28.0, 8.30.1 | 8.30.1 |
| @vercel/microfrontends | 1.0.0 | 1.1.0 |
| @vercel/toolbar | 0.1.35 | 0.1.36 |
| @vite-pwa/sveltekit | 0.6.7 | 0.6.8 |
| abbrev | 3.0.0 | 3.0.1 |
| bare-fs | 4.0.2 | 4.1.2 |
| bits-ui | 1.3.19 | 0.21.16, 1.3.19 |
| caniuse-lite | 1.0.30001707 | 1.0.30001715 |
| chalk | 4.1.2 | 4.1.2, 5.4.1 |
| dompurify | 3.2.4 | 3.2.5 |
| dotenv | 16.4.7 | 16.5.0 |
| electron-to-chromium | 1.5.123 | 1.5.139 |
| eslint-plugin-n | 17.16.2 | 17.17.0 |
| esrap | 1.4.5 | 1.4.6 |
| fdir | 6.4.3, 6.4.4 | 6.4.4 |
| minizlib | 3.0.1 | 3.0.2 |
| pirates | 4.0.6 | 4.0.7 |
| posthog-node | 4.10.2 | 4.12.0 |
| rimraf | 2.7.1, 5.0.10 | 2.7.1 |
| rollup | 2.79.2, 4.37.0, 4.40.0 | 2.79.2, 4.40.0 |
| saxes | 5.0.1 | 5.0.1, 6.0.0 |
| source-map | 0.6.1, 0.8.0-beta.0 | 0.6.1, 0.7.4, 0.8.0-beta.0 |
| tinyglobby | 0.2.12, 0.2.13 | 0.2.13 |
| tr46 | 0.0.3, 1.0.1 | 0.0.3, 1.0.1, 5.1.1 |
| typescript-eslint | 8.28.0 | 8.30.1 |
| undici-types | 6.20.0, 6.21.0 | 6.21.0 |
| webidl-conversions | 3.0.1, 4.0.2 | 3.0.1, 4.0.2, 7.0.0 |
| whatwg-url | 5.0.0, 7.1.0 | 14.2.0, 5.0.0, 7.1.0 |
| yaml | 1.10.2, 2.7.0 | 1.10.2, 2.7.1 |
import { preprocessMeltUI, sequence } from '@melt-ui/pp';
import adapterVercel from '@sveltejs/adapter-vercel';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { generateSW } from './pwa.mjs';
/** @type {import('@sveltejs/kit').Config}*/
const config = {
    preprocess: sequence([vitePreprocess(), preprocessMeltUI()]),
    kit: {
        adapter: adapterVercel({
            regions: ['fra1'],
            external: ['pg-native'],
            split: false
        }),
        version: {
            pollInterval: 10000
        },
        alias: {
            // '$paraglide': './src/lib/paraglide',
            '$paraglide/*': './src/lib/paraglide/*',
            '$db-types': './src/database.types.merged.ts',
            '$schemas/*': './src/lib/schemas/*',
            '$stores/*': './src/lib/stores/*',
            '$utils/*': './src/lib/utils/*',
            '$icons/*': './src/lib/icons/*',
            '$components/*': './src/lib/components/*',
            '$api/*': './src/routes/api/*',
            '$db/*': './src/lib/server/db/*',
            '$routes/*': './src/routes/*'
        },
        serviceWorker: {
            register: false
        },
        files: {
            // you don't need to do this if you're using generateSW strategy in your app
            serviceWorker: generateSW ? undefined : 'src/prompt-sw.ts'
        }
    }
};
export default config;

I will post back in this thread once I have done the step-by-step update->test->vercelbuild->verify and am up-to-date on my dependencies.
fyi: I still have to verify other changes that might have had an effect as well, but the pnpm-lock.yaml revert felt like it was the thing that did the trick.
Edit: upon further testing and investigation I am fairly certain it was caused by a change in the dependencies, not yet started with the package-by-package update checks

Thanks again for reaching out so quickly!

With kind regards,
Jord

1 Like

Hi Anshuman,

I started the journey of updating one-by-one, and got a direct hit.

When updating from @sveltejs/adapter-vercel@5.6.3 to @sveltejs/adapter-vercel@5.7.0 the functions splitting started happening again.

here are the changes in pnpm-lock.yaml

## Updated Packages (3)

| Package | Old Version | New Version |
|---------|-------------|-------------|
| @sveltejs/adapter-vercel | 5.6.3 | 5.7.0 |
| abbrev | 3.0.0 | 3.0.1 |
| detect-libc | 1.0.3, 2.0.3 | 1.0.3, 2.0.3, 2.0.4 |

what other files might be needed to better understand what is happening?

Looking forward to getting to the bottom of this with your help.

With kind regards,
Jord

Hi @jordvisser-gmailcom, thanks for sharing additional resources here. Have you tried opening an issue with GitHub - sveltejs/kit: web development, streamlined? Maybe they are able to dig in further.

If possible can you please share your public repo or a minimal reproducible example. That will let us all work together from the same code to figure out what’s going wrong.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.