Edit this page
+client.js
You can define a +client.js
file to add client-side JavaScript.
It's usually used for initializing error tracking, user tracking, cookie consent, CSS frameworks, etc.
In production, it's the very first JavaScript code to be executed. In development, it's run first after Vite's HMR preamble.
The code of
+client.js
isn't re-executed upon client-side page navigation. For executing code upon the lifecycle of page rendering, see following hooks instead:
Currently,
+client.js
isn't cumulative but it's work-in-progress, see 1834 - Make+client.js
cumulative.