⚠️
The vite-plugin-ssr project has been renamed Vike.
  • If you are already using vite-plugin-ssr then migrate to Vike.
  • For new projects, don't use vite-plugin-ssr but use Vike instead.

client

The client config is part of the V1 design.

The client config adds client-side code executed at load time.

For executing code upon page lifecycle changes, see following hooks instead: onHydrationEnd(), onPageTransitionStart(), and onPageTransitionEnd().

// +config.h.js
export default {
  client: './some-client-code.js'
}
// some-client-code.js
console.log("I'm run when the client-side JavaScript is loaded.")

Example

See /examples/render-modes-v1/pages/html-js/+client.js.