File tree Expand file tree Collapse file tree 3 files changed +19
-17
lines changed
subjects/multiple-prerendering Expand file tree Collapse file tree 3 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ module.exports = async function (env, params) {
2626 ) ;
2727 return '' ;
2828 }
29- return ( await prerender ( app , { ...params , url } ) ) . html ;
29+ return ( await prerender ( app , { props : { ...params , url } } ) ) . html ;
3030 } catch ( err ) {
3131 let stack = stackTrace . parse ( err ) . filter ( s => s . getFileName ( ) === entry ) [ 0 ] ;
3232 if ( ! stack ) {
Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ describe('preact build', () => {
362362 } ) ;
363363 } ) ;
364364
365- describe . skip ( 'prerender' , ( ) => {
365+ describe ( 'prerender' , ( ) => {
366366 prerenderUrlFiles . forEach ( prerenderUrls => {
367367 it ( `should prerender the routes provided with '${ prerenderUrls } '` , async ( ) => {
368368 let dir = await subject ( 'multiple-prerendering' ) ;
Original file line number Diff line number Diff line change 11import { Component } from 'preact' ;
2- import { Router } from 'preact-router' ;
3- import Home from './routes/home' ;
4- import Route66 from './routes/route66' ;
5- import Custom from './routes/custom' ;
2+ import { LocationProvider , Router } from 'preact-iso/router' ;
3+ import { default as lazy , ErrorBoundary } from 'preact-iso/lazy' ;
4+
5+ const Home = lazy ( ( ) => import ( './routes/home.js' ) ) ;
6+ const Route66 = lazy ( ( ) => import ( './routes/route66.js' ) ) ;
7+ const Custom = lazy ( ( ) => import ( './routes/custom.js' ) ) ;
68import './style.css' ;
79
810export default class App extends Component {
9- handleRoute = e => {
10- this . currentUrl = e . url ;
11- } ;
12-
1311 render ( props ) {
1412 return (
15- < div id = "app" >
16- < Router url = { props . url } onChange = { this . handleRoute } { ...props } >
17- < Home path = "/" />
18- < Route66 path = "/route66" />
19- < Custom path = "/custom" { ...props } />
20- </ Router >
21- </ div >
13+ < LocationProvider >
14+ < div id = "app" >
15+ < ErrorBoundary >
16+ < Router url = { props . url } { ...props } >
17+ < Home path = "/" />
18+ < Route66 path = "/route66" />
19+ < Custom path = "/custom" { ...props } />
20+ </ Router >
21+ </ ErrorBoundary >
22+ </ div >
23+ </ LocationProvider >
2224 ) ;
2325 }
2426}
You can’t perform that action at this time.
0 commit comments