Skip to content

Commit

Permalink
fix(prerender): fix component graph tmp file
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Oct 27, 2020
1 parent cf8847b commit bb9b6a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compiler/prerender/prerender-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ const runPrerenderOutputTarget = async (
srcIndexHtmlPath,
outputTarget,
hydrateOpts,
manager
manager,
);
if (diagnostics.length > 0 || !templateData || !isString(templateData.html)) {
return;
}

manager.templateId = await createPrerenderTemplate(config, templateData.html);
manager.staticSite = templateData.staticSite;
manager.componentGraphPath = createComponentGraphPath(config, componentGraph, outputTarget);
manager.componentGraphPath = await createComponentGraphPath(config, componentGraph, outputTarget);

await new Promise(resolve => {
manager.resolve = resolve;
Expand Down Expand Up @@ -261,14 +261,14 @@ const createPrerenderTemplate = async (config: d.Config, templateHtml: string) =
return templateId;
};

const createComponentGraphPath = (
const createComponentGraphPath = async (
config: d.Config,
componentGraph: d.BuildResultsComponentGraph,
outputTarget: d.OutputTargetWww,
) => {
if (componentGraph) {
const content = getComponentPathContent(componentGraph, outputTarget);
const hash = config.sys.generateContentHash(content);
const hash = await config.sys.generateContentHash(content);
const fileName = `prerender-component-graph-${hash}.json`;
const componentGraphPath = join(config.sys.tmpDirSync(), fileName);
config.sys.writeFileSync(componentGraphPath, content);
Expand Down

0 comments on commit bb9b6a8

Please sign in to comment.