-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ssr.prerender configuration for umi build prerender (umijs#…
…7269) * feat: 增加 ssr.prerender 配置控制是否开启构建预渲染逻辑 * feat: add type and test * test: fix ssr prod build load react-router error Co-authored-by: sky <[email protected]>
- Loading branch information
Showing
10 changed files
with
90 additions
and
1 deletion.
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
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
10 changes: 10 additions & 0 deletions
10
packages/preset-built-in/src/fixtures/ssr-prerender-no/.umirc.ts
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { IConfig } from '@umijs/types'; | ||
|
||
export default { | ||
ssr: { | ||
prerender: false, | ||
removeWindowInitialProps: false | ||
}, | ||
exportStatic: {}, | ||
routes: [{ path: '/', component: 'index' }], | ||
} as IConfig; |
12 changes: 12 additions & 0 deletions
12
packages/preset-built-in/src/fixtures/ssr-prerender-no/pages/index.tsx
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
|
||
const Home = (props: any) => { | ||
|
||
return <div><h2>{props.message}</h2></div>; | ||
}; | ||
|
||
Home.getInitialProps = async () => { | ||
return { message: 'prerender' } | ||
}; | ||
|
||
export default Home; |
10 changes: 10 additions & 0 deletions
10
packages/preset-built-in/src/fixtures/ssr-prerender/.umirc.ts
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { IConfig } from '@umijs/types'; | ||
|
||
export default { | ||
ssr: {}, | ||
exportStatic: {}, | ||
routes: [{ path: '/', component: 'index' }], | ||
alias: { | ||
'react-router': require.resolve('react-router/cjs/react-router.js'), | ||
}, | ||
} as IConfig; |
12 changes: 12 additions & 0 deletions
12
packages/preset-built-in/src/fixtures/ssr-prerender/pages/index.tsx
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
|
||
const Home = (props: any) => { | ||
return <div><h2>{props.message}</h2></div>; | ||
}; | ||
|
||
Home.getInitialProps = async () => { | ||
return { message: 'prerender' } | ||
}; | ||
|
||
export default Home; | ||
|
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
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