# Function: lazy()

> 

> **lazy**\<`TRouter`\>(`importRouter`): `Lazy`\<`NoInfer`\<`TRouter`\>\>

Defined in: [packages/server/src/unstable-core-do-not-import/router.ts:125](https://github.com/trpc/trpc/blob/7c907acfd8b31929214792e3b8c2ad7a8ac72563/packages/server/src/unstable-core-do-not-import/router.ts#L125)

Loads a router on its first call instead of at startup, which can make
cold starts faster. Pass a function that imports the router, or a module
whose only export is the router.

## Type Parameters

| Type Parameter |
| ------ |
| `TRouter` *extends* [`AnyTRPCRouter`](https://trpc.io/docs/typedoc/server/index/type-aliases/AnyTRPCRouter.md) |

## Parameters

| Parameter | Type |
| ------ | ------ |
| `importRouter` | () => `Promise`\<`TRouter` \| \{\}\> |

## Returns

`Lazy`\<`NoInfer`\<`TRouter`\>\>

## Example

```ts
const appRouter = router({
  slow: lazy(() => import('./slow.js').then((m) => m.slowRouter)),
});
```

## See

https://trpc.io/docs/server/merging-routers#lazy-load
