Skip to content

Commit 7da82a3

Browse files
feat: entries
1 parent 42cbc45 commit 7da82a3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/node/assets.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function collectAssets({
2828
ssrManifest,
2929
}: CollectAssetsOpts) {
3030
const matches = matchRoutes([...routes], locationArg, base)
31+
const routeEntries = matches?.map(item => item.route.entry).filter(Boolean) as string[] ?? []
3132
const dynamicImports = new Set<string>()
3233
matches?.forEach(item => {
3334
let lazyStr = ''
@@ -45,6 +46,7 @@ export function collectAssets({
4546
}
4647
})
4748
const entries = new Set<string>()
49+
routeEntries.forEach(e => entries.add(e))
4850
const manifestEntries = [...Object.entries(serverManifest)]
4951
dynamicImports.forEach(name => {
5052
const result = manifestEntries.find(([_, value]) => value.file.endsWith(name))

src/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ export interface ViteReactSSGClientOptions {
142142
}
143143

144144
interface CommonRouteOptions {
145+
/**
146+
* Used to obtain static resources through manifest
147+
*
148+
* **You are not required to use this field. It is only necessary when "prehydration style loss" occurs.**
149+
*
150+
* @example `src/pages/home.tsx`
151+
*/
152+
entry?: string
145153
/**
146154
* The getStaticPaths() function should return an array of path
147155
* to determine which paths will be pre-rendered by vite-react-ssg.

0 commit comments

Comments
 (0)