From cabf39803e66219dfbbee3c51c24dc7e562ecf02 Mon Sep 17 00:00:00 2001 From: akdlsz21 Date: Sat, 13 Sep 2025 17:58:59 +0900 Subject: [PATCH 1/2] use location.origin; make console links origin-aware Replace localhost/token URL in open-in-editor --- packages/devtools-vite/src/plugin.ts | 9 --------- packages/devtools/src/devtools.tsx | 4 +++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/devtools-vite/src/plugin.ts b/packages/devtools-vite/src/plugin.ts index 0d55d2e2..6dfcfe1e 100644 --- a/packages/devtools-vite/src/plugin.ts +++ b/packages/devtools-vite/src/plugin.ts @@ -119,15 +119,6 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array => { }), ) }, - transform(code) { - if (code.includes('__TSD_PORT__')) { - code = code.replace('__TSD_PORT__', String(port)) - } - if (code.includes('__TSD_HOST__')) { - code = code.replace('__TSD_HOST__', host) - } - return code - }, }, { name: '@tanstack/devtools:better-console-logs', diff --git a/packages/devtools/src/devtools.tsx b/packages/devtools/src/devtools.tsx index b02664ef..ab5270cf 100644 --- a/packages/devtools/src/devtools.tsx +++ b/packages/devtools/src/devtools.tsx @@ -174,7 +174,9 @@ export default function DevTools() { e.preventDefault() e.stopPropagation() fetch( - `__TSD_HOST__://localhost:__TSD_PORT__/__tsd/open-source?source=${encodeURIComponent(dataSource)}`, + `${location.origin}/__tsd/open-source?source=${encodeURIComponent( + dataSource, + )}`, ).catch(() => {}) } } From cc5bcac71fba0ee9aa5ed6599aae2c34036ee5ef Mon Sep 17 00:00:00 2001 From: akdlsz21 Date: Tue, 16 Sep 2025 20:04:04 +0900 Subject: [PATCH 2/2] remove unused host variable and configResolved --- packages/devtools-vite/src/plugin.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/devtools-vite/src/plugin.ts b/packages/devtools-vite/src/plugin.ts index 6dfcfe1e..dfe2669a 100644 --- a/packages/devtools-vite/src/plugin.ts +++ b/packages/devtools-vite/src/plugin.ts @@ -44,7 +44,6 @@ export const defineDevtoolsConfig = (config: TanStackDevtoolsViteConfig) => export const devtools = (args?: TanStackDevtoolsViteConfig): Array => { let port = 5173 - let host = 'http' const enhancedLogsConfig = args?.enhancedLogs ?? { enabled: true } const injectSourceConfig = args?.injectSource ?? { enabled: true } const bus = new ServerEventBus(args?.eventBusConfig) @@ -71,9 +70,6 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array => { { enforce: 'pre', name: '@tanstack/devtools:custom-server', - configResolved(config) { - host = config.server.https?.cert ? 'https' : 'http' - }, apply(config) { // Custom server is only needed in development for piping events to the client return config.mode === 'development'