Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 61x 61x 61x 61x 61x 151x 151x 151x 151x | import fs from 'fs';
import { IUnleashConfig } from '../server-impl';
import { rewriteHTML } from './rewriteHTML';
import path from 'path';
import fetch from 'make-fetch-happen';
export async function loadIndexHTML(
config: IUnleashConfig,
publicFolder: string,
): Promise<string> {
const { cdnPrefix, baseUriPath = '' } = config.server;
let indexHTML: string;
Iif (cdnPrefix) {
const res = await fetch(`${cdnPrefix}/index.html`);
indexHTML = await res.text();
} else {
indexHTML = fs
.readFileSync(path.join(publicFolder, 'index.html'))
.toString();
}
return rewriteHTML(indexHTML, baseUriPath, cdnPrefix);
}
|