Skip to content
Source
Sign inSign up
TanStack/router

fix: dev serverfn resolution on windows #5520

Mergedschiller-manuel(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/5520/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

Showing 2 changed files with 17 additions and 2 deletions.

x
0 of 2 viewed, 2 left
16 additions and 1 deletionpackages/server-functions-plugin/src/index.tsModified
View file
@@ -68,17 +68,32 @@
const entryIdToFunctionId = new Map<string, string>()
const functionIds = new Set<string>()
​
+ function withTrailingSlash(path: string): string {
+ if (path[path.length - 1] !== '/') {
+ return `${path}/`
+ }
+ return path
+ }
+​
const generateFunctionId: GenerateFunctionIdFn = ({
extractedFilename,
functionName,
filename,
}) => {
if (serverDevEnv) {
+ const root = serverDevEnv.config.root
+​
+ let file = extractedFilename
+ if (extractedFilename.startsWith(withTrailingSlash(root))) {
+ file = extractedFilename.slice(root.length)
+ }
+ file = `/@id${file[0] === '/' ? '' : '/'}${file}`
+​
const serverFn: {