Skip to content

Commit

Permalink
properly return correct non intercept promise (#866)
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 authored Jan 13, 2022
1 parent f47bf1f commit 0731dc0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/cli/src/lifecycles/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path';

async function interceptPage(compilation, contents, route) {
const headers = {
request: { 'accept': 'text/hml', 'content-type': 'text/html' },
request: { 'accept': 'text/html', 'content-type': 'text/html' },
response: { 'content-type': 'text/html' }
};
const interceptResources = compilation.config.plugins.filter((plugin) => {
Expand All @@ -16,12 +16,12 @@ async function interceptPage(compilation, contents, route) {
});

const htmlIntercepted = await interceptResources.reduce(async (htmlPromise, resource) => {
const html = (await htmlPromise).body || '';
const html = (await htmlPromise).body;
const shouldIntercept = await resource.shouldIntercept(route, html, headers);

return shouldIntercept
? resource.intercept(route, html, headers)
: Promise.resolve(html);
: htmlPromise;
}, Promise.resolve(contents));

return htmlIntercepted;
Expand Down

0 comments on commit 0731dc0

Please sign in to comment.