forked from imbytecat/fullstack-starter
fix(server): 避免 SSR 导入 *.client 模块导致构建失败
This commit is contained in:
@@ -54,7 +54,7 @@ bun test -t "pattern" # Run tests matching pattern
|
|||||||
```
|
```
|
||||||
src/
|
src/
|
||||||
├── client/ # Client-side code
|
├── client/ # Client-side code
|
||||||
│ ├── orpc.client.ts # ORPC isomorphic client
|
│ ├── orpc.ts # ORPC isomorphic client
|
||||||
│ └── query-client.ts # TanStack Query client
|
│ └── query-client.ts # TanStack Query client
|
||||||
├── components/ # React components
|
├── components/ # React components
|
||||||
├── routes/ # TanStack Router file routes
|
├── routes/ # TanStack Router file routes
|
||||||
@@ -119,7 +119,7 @@ export const router = os.router({ feature })
|
|||||||
### 4. Use in Components
|
### 4. Use in Components
|
||||||
```typescript
|
```typescript
|
||||||
import { useSuspenseQuery, useMutation } from '@tanstack/react-query'
|
import { useSuspenseQuery, useMutation } from '@tanstack/react-query'
|
||||||
import { orpc } from '@/client/orpc.client'
|
import { orpc } from '@/client/orpc'
|
||||||
|
|
||||||
const { data } = useSuspenseQuery(orpc.feature.list.queryOptions())
|
const { data } = useSuspenseQuery(orpc.feature.list.queryOptions())
|
||||||
const mutation = useMutation(orpc.feature.create.mutationOptions())
|
const mutation = useMutation(orpc.feature.create.mutationOptions())
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createTanstackQueryUtils } from '@orpc/tanstack-query'
|
import { createTanstackQueryUtils } from '@orpc/tanstack-query'
|
||||||
import { orpc as orpcClient } from './orpc.client'
|
import { orpc as orpcClient } from './orpc'
|
||||||
|
|
||||||
export const orpc = createTanstackQueryUtils(orpcClient, {
|
export const orpc = createTanstackQueryUtils(orpcClient, {
|
||||||
experimental_defaults: {
|
experimental_defaults: {
|
||||||
|
|||||||
Reference in New Issue
Block a user