-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: generate route runtime module by isSSR
- Loading branch information
1 parent
75fbb8e
commit ecc54f5
Showing
4 changed files
with
20 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import { FactoryContext, RuntimeModuleID } from '.'; | ||
|
||
export async function routeVMPlugin(context: FactoryContext) { | ||
const { routeService } = context; | ||
const { routeService, isSSR } = context; | ||
|
||
if (isSSR) { | ||
return { | ||
[RuntimeModuleID.RouteForSSR]: routeService.generateRoutesCode(true), | ||
}; | ||
} | ||
|
||
// client: The components of route is lazy loaded | ||
return { | ||
[RuntimeModuleID.RouteForClient]: routeService.generateRoutesCode(false), | ||
[RuntimeModuleID.RouteForSSR]: routeService.generateRoutesCode(true), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters