File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ type Options = {
21
21
output ? : string ;
22
22
title ? : string ;
23
23
templateFileName ? : string ;
24
- redocOptions ? : object ;
24
+ redocOptions ? : any ;
25
25
} ;
26
26
27
27
const BUNDLES_DIR = dirname ( require . resolve ( 'redoc' ) ) ;
@@ -200,7 +200,9 @@ async function getPageHTML(
200
200
let redocStandaloneSrc ;
201
201
if ( ssr ) {
202
202
console . log ( 'Prerendering docs' ) ;
203
- const store = await createStore ( spec , pathToSpec , redocOptions ) ;
203
+
204
+ const specUrl = redocOptions . specUrl || ( isURL ( pathToSpec ) ? pathToSpec : undefined ) ;
205
+ const store = await createStore ( spec , specUrl , redocOptions ) ;
204
206
const sheet = new ServerStyleSheet ( ) ;
205
207
html = renderToString ( sheet . collectStyles ( React . createElement ( Redoc , { store } ) ) ) ;
206
208
css = sheet . getStyleTags ( ) ;
@@ -282,3 +284,7 @@ function debounce(callback: Function, time: number) {
282
284
} , time ) ;
283
285
} ;
284
286
}
287
+
288
+ function isURL ( str : string ) : boolean {
289
+ return / ^ ( h t t p s ? : ) \/ \/ / m. test ( str ) ;
290
+ }
You can’t perform that action at this time.
0 commit comments