fix(devtools-vite): inject data-tsd-source before other plugins transform by AlemTuzlak · Pull Request #548 · TanStack/devtools · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/inject-source-order-pre.md
6 changes: 6 additions & 0 deletions packages/devtools-vite/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array<Plugin> => {
return config.mode === 'development' && injectSourceConfig.enabled
},
transform: {
// Run before the transforms of plugins without `order: 'pre'`, also when
// devtools() is not first in the plugins array. A plugin that changes
// the code of one environment only would shift the lines and make the
// SSR and client locations differ, which breaks hydration. An earlier
// plugin whose transform also has `order: 'pre'` still runs first.
order: 'pre',
Comment thread
coderabbitai[bot] marked this conversation as resolved.
filter: {
id: {
exclude: [/node_modules/, /\?raw/, /\/dist\//, /\/build\//],
Expand Down
62 changes: 62 additions & 0 deletions packages/devtools-vite/tests/inject-source-order.test.ts
Loading