Serialization
Server function arguments and return values are serialized so they can travel between server and client.
Configuration
Set the mode on solidStart() in vite.config.ts:
import { defineConfig } from "vite";import { solidStart } from "@solidjs/start/config";
export default defineConfig({ plugins: [ solidStart({ serialization: { mode: "json" }, }), ],});Modes
json: deserializes withJSON.parseon the client. It avoidseval, so it fits a strict CSP. This is the default.js: a smaller binary format that needsevalon the client, which a strong CSP blocks.
If your app enforces a Content Security Policy, keep json.
Server function payloads
SolidStart applies extra handling for certain payload types so file uploads and binary data can flow without being serialized by Seroval. This applies to both server function arguments and return values. SolidStart bypasses Seroval for:
FormDataURLSearchParamsUint8ArrayArrayBufferBlobFilestring
Because these values are transferred directly, this can yield smaller payloads for these cases.