Skip to content
Source
Sign inSign up
TanStack/devtools

fix(devtools-vite): inject the bus port into pre-bundled dependency chunks #538

MergedAlemTuzlakmerged 1 commit intomain fromrefs/pull/538/headmerged by AlemTuzlak View on GitHub

Showing 3 changed files with 21 additions and 1 deletion.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/vite-deps-bus-port.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/devtools-vite': patch
+---
+​
+Inject the event bus port, host, and protocol into Vite pre-bundled dependency chunks too. Before this fix, a client installed from npm kept the default port 4206 and could not connect when the server bus used another port.
4 additions and 1 deletionpackages/devtools-vite/src/plugin.tsModified
View file
@@ -581,9 +581,12 @@
code.includes('__TANSTACK_DEVTOOLS_HOST__') ||
code.includes('__TANSTACK_DEVTOOLS_PROTOCOL__')
if (!hasPlaceholder) return
+ // Vite pre-bundles npm installs into chunks under `.vite/deps*`, whose
+ // ids no longer name the package.
if (
!id.includes('@tanstack/devtools') &&
- !id.includes('@tanstack/event-bus')
+ !id.includes('@tanstack/event-bus') &&
+ !id.includes('/.vite/deps')
return
​
12 additions and 0 deletionspackages/devtools-vite/tests/index.test.tsModified
View file
@@ -166,6 +166,18 @@
expect(result).toBeUndefined()
​