Skip to content

Commit 5adb5ea

Browse files
committed
fix(kit): give each devtools storage scope its own directory
1 parent fe7820b commit 5adb5ea

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎packages/kit/src/node/vite-host.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,18 @@ export function createViteDevToolsHost(options: CreateViteDevToolsHostOptions):
112112
const reachable = host === '0.0.0.0' || host === '::' || !host ? 'localhost' : host
113113
return `${https ? 'https' : 'http'}://${reachable}:${port}`
114114
},
115+
/**
116+
* Mirror devframe's storage layout: `workspace` is committable and
117+
* team-shared, `project` rotates with the checkout's `node_modules`, and
118+
* `global` is per-user. Each scope needs its own directory, or a
119+
* per-checkout file lands where every other project reads it.
120+
*/
115121
getStorageDir(scope) {
116-
return scope === 'workspace'
117-
? join(workspaceRoot, 'node_modules/.vite/devtools')
118-
: join(homedir(), '.vite/devtools')
122+
if (scope === 'workspace')
123+
return join(workspaceRoot, '.vite-devtools')
124+
if (scope === 'project')
125+
return join(workspaceRoot, 'node_modules/.vite/devtools')
126+
return join(homedir(), '.vite/devtools')
119127
},
120128
}
121129
}

0 commit comments

Comments
 (0)