devtools/packages/devtools-vite
Alem Tuzlak 40f32e4cda
fix(devtools-vite): inject data-tsd-source before other plugins transform (#548)
* fix(devtools-vite): inject data-tsd-source before other plugins transform

inject-source uses `enforce: 'pre'`, so a `pre` plugin listed before
devtools() transformed the code first. When that plugin changes the code of
one environment only (a server-function compiler, for example), the lines
shift, and data-tsd-source differs between the SSR and client output. React
then reports a hydration mismatch, for example
`editor.tsx:632:5` on the server and `editor.tsx:636:5` on the client.

The transform hook now has `order: 'pre'`, so it runs before the other
plugins' transform hooks, whatever their position in the array.

Fixes #405
Fixes #189

* docs(devtools-vite): note that an earlier order: 'pre' transform still runs first
History 2026-10-29 16:18:54 +01:00
..
bin ci: Version Packages (#380) 2026-03-11 14:39:21 +01:00
skills/devtools-vite-plugin refactor(devtools-vite): migrate from Babel to oxc-parser + MagicString (#397) 2026-05-13 16:13:22 +02:00
src fix(devtools-vite): inject data-tsd-source before other plugins transform (#548) 2026-10-29 16:18:54 +01:00
tests fix(devtools-vite): inject data-tsd-source before other plugins transform (#548) 2026-10-29 16:18:54 +01:00
CHANGELOG.md ci: Version Packages (#512) 2026-08-20 12:38:11 +02:00
eslint.config.js Feat/vite plugin (#53) 2025-08-21 14:26:14 +02:00
package.json ci: Version Packages (#512) 2026-08-20 12:38:11 +02:00
README.md Feat/vite plugin (#53) 2025-08-21 14:26:14 +02:00
tsconfig.docs.json Feat/vite plugin (#53) 2025-08-21 14:26:14 +02:00
tsconfig.json Feat/vite plugin (#53) 2025-08-21 14:26:14 +02:00
vite.config.ts docs: correct local relative links (#282) 2025-12-05 22:38:56 +11:00

@tanstack/devtools-vite

This package is still under active development and might have breaking changes in the future. Please use it with caution.

General Usage

The @tanstack/devtools-vite package is designed to work with Vite projects. Plug it into your plugins array:

import { devtools } from '@tanstack/devtools-vite'

export default {
  plugins: [
    // Important to include it first!
    devtools(),
    ... //rest of the plugins
  ],
}