@@ -26,6 +26,7 @@ export type ServerFnPluginOpts = {
2626 client : ServerFnPluginEnvOpts
2727 ssr : ServerFnPluginEnvOpts
2828 server : ServerFnPluginEnvOpts
29+ importer ?: ( fn : DirectiveFn ) => Promise < any >
2930}
3031
3132const manifestFilename =
@@ -62,7 +63,8 @@ export function createTanStackServerFnPlugin(opts: ServerFnPluginOpts): {
6263 // into the manifest because it's a dynamic import. Instead, as you'll
6364 // see below, we augment the manifest output with a code-generated importer
6465 // that looks exactly like this.
65- importer : ( ) => import ( fn . extractedFilename ) ,
66+ importer : ( ) =>
67+ opts . importer ? opts . importer ( fn ) : import ( fn . extractedFilename ) ,
6668 } ,
6769 ] ) ,
6870 ) ,
@@ -202,6 +204,7 @@ export interface TanStackServerFnPluginEnvOpts {
202204 getRuntimeCode : ( ) => string
203205 replacer : ReplacerFn
204206 }
207+ importer : ( fn : DirectiveFn ) => Promise < any >
205208}
206209
207210export function TanStackServerFnPluginEnv (
@@ -240,7 +243,8 @@ export function TanStackServerFnPluginEnv(
240243 // into the manifest because it's a dynamic import. Instead, as you'll
241244 // see below, we augment the manifest output with a code-generated importer
242245 // that looks exactly like this.
243- importer : ( ) => import ( fn . extractedFilename ) ,
246+ importer : ( ) =>
247+ opts . importer ? opts . importer ( fn ) : import ( fn . extractedFilename ) ,
244248 } ,
245249 ] ) ,
246250 ) ,
0 commit comments