Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Nov 7, 2024
1 parent 82334fa commit 9d9a3e1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/zh/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ import { remixFlatRoutes } from 'vite-plugin-remix-flat-routes'
export default defineConfig({
plugins: [
react(),
remixFlatRoutes()],
remixFlatRoutes()
],
})
```

Expand Down
5 changes: 5 additions & 0 deletions src/node/route-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,16 @@ export class RouteUtil {
)

// Constant/Function Exports
setProps('clientLoader', this.constantInExports(route, { importee, namedExport: 'clientLoader' }))
setProps(
'loader',
this.constantInExports(route, {
importee,
namedExport: 'loader',
}),
)

setProps('clientAction', this.constantInExports(route, { importee, namedExport: 'clientAction' }))
setProps(
'action',
this.constantInExports(route, {
Expand Down Expand Up @@ -326,7 +329,9 @@ export class RouteUtil {
* @see https://reactrouter.com/en/main/route/route
*/
hasAction: sourceExports.includes('action'),
hasClientAction: sourceExports.includes('clientAction'),
hasLoader: sourceExports.includes('loader'),
hasClientLoader: sourceExports.includes('clientLoader'),
hasHandle: sourceExports.includes('handle'),
hasShouldRevalidate: sourceExports.includes('shouldRevalidate'),
hasErrorBoundary: sourceExports.includes('ErrorBoundary'),
Expand Down
6 changes: 6 additions & 0 deletions src/node/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ export type ProcessedRouteManifest = {
* 路由文件是否默认导出
*/
hasDefaultExport?: boolean

/**
* react-router@7
*/
hasClientLoader?: boolean
hasClientAction?: boolean
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ function getRouteFiles(config: {
)
}

export const reactRefreshUnsupportedExports = ['handle', 'loader', 'action', 'shouldRevalidate', 'lazy']
export const reactRefreshUnsupportedExports = [
'handle',
'loader',
'clientLoader',
'action',
'clientAction',
'shouldRevalidate',
'lazy',
]

export function reactRefreshHack(config: {
viteConfig: Vite.ResolvedConfig
Expand Down

0 comments on commit 9d9a3e1

Please sign in to comment.