fix: support instrumentation for `vite preview` (#15105)
authorAlois Klink <alois@aloisklink.com>
Tue, 6 Jan 2026 20:21:25 +0000 (05:21 +0900)
committerGitHub <noreply@github.com>
Tue, 6 Jan 2026 20:21:25 +0000 (13:21 -0700)
commit7237e8d26fbaa659559183d0a8735c1d8614f620
tree920bdd2784e72781c9e14bd6d6853fcf5431197f
parent0c0a906dd44efc0b12636936d6fdb8b424f0c65f
fix: support instrumentation for `vite preview` (#15105)

The `instrumentation.server.js` file is now imported when running
`vite preview`. Unfortunately, since it's not the first thing that's
imported (all of Vite's depedencies are imported first), some
instrumentation that rely on monkey-patching imports might not work
properly, but at least we're importing it before the server code.
However, this matches the existing behaviour of `vite dev`.

See: https://github.com/sveltejs/kit/blob/51214794b40b2fc533b06cb8344e84e661f90be0/packages/kit/src/exports/vite/dev/index.js#L507-L513
.changeset/loud-glasses-enter.md [new file with mode: 0644]
packages/kit/src/exports/vite/preview/index.js