File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
server-functions-plugin/src Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -68,17 +68,32 @@ export function TanStackServerFnPlugin(
6868 const entryIdToFunctionId = new Map < string , string > ( )
6969 const functionIds = new Set < string > ( )
7070
71+ function withTrailingSlash ( path : string ) : string {
72+ if ( path [ path . length - 1 ] !== '/' ) {
73+ return `${ path } /`
74+ }
75+ return path
76+ }
77+
7178 const generateFunctionId : GenerateFunctionIdFn = ( {
7279 extractedFilename,
7380 functionName,
7481 filename,
7582 } ) => {
7683 if ( serverDevEnv ) {
84+ const root = serverDevEnv . config . root
85+
86+ let file = extractedFilename
87+ if ( extractedFilename . startsWith ( withTrailingSlash ( root ) ) ) {
88+ file = extractedFilename . slice ( root . length )
89+ }
90+ file = `/@id${ file [ 0 ] === '/' ? '' : '/' } ${ file } `
91+
7792 const serverFn : {
7893 file : string
7994 export : string
8095 } = {
81- file : extractedFilename ,
96+ file,
8297 export : functionName ,
8398 }
8499 const base64 = Buffer . from ( JSON . stringify ( serverFn ) , 'utf8' ) . toString (
Original file line number Diff line number Diff line change 1- export function getServerFnById ( ) { }
1+ export async function getServerFnById ( ) : Promise < any > { }
You can’t perform that action at this time.
0 commit comments