Skip to content

Commit 39d3355

Browse files
committed
docs(devtools-vite): note that an earlier order: 'pre' transform still runs first
1 parent 4f63886 commit 39d3355

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎.changeset/inject-source-order-pre.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@tanstack/devtools-vite': patch
33
---
44

5-
Run source injection before the transforms of other plugins, also when `devtools()` is not first in the plugins array. Before this fix, a framework plugin that changed the code of only one environment shifted the line numbers, so `data-tsd-source` differed between SSR and client and caused hydration warnings.
5+
Run source injection before the transforms of other plugins (unless they also use `order: 'pre'`), also when `devtools()` is not first in the plugins array. Before this fix, a framework plugin that changed the code of only one environment shifted the line numbers, so `data-tsd-source` differed between SSR and client and caused hydration warnings.

‎packages/devtools-vite/src/plugin.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array<Plugin> => {
6060
return config.mode === 'development' && injectSourceConfig.enabled
6161
},
6262
transform: {
63-
// Run before the other plugins' transforms, also when devtools() is not
64-
// first in the plugins array. A plugin that changes the code of one
65-
// environment only would shift the lines and make the SSR and client
66-
// locations differ, which breaks hydration.
63+
// Run before the transforms of plugins without `order: 'pre'`, also when
64+
// devtools() is not first in the plugins array. A plugin that changes
65+
// the code of one environment only would shift the lines and make the
66+
// SSR and client locations differ, which breaks hydration. An earlier
67+
// plugin whose transform also has `order: 'pre'` still runs first.
6768
order: 'pre',
6869
filter: {
6970
id: {

0 commit comments

Comments
 (0)