Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Support preloading ES6 modules in exported pages (#1539)
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardolardi authored Sep 20, 2020
1 parent bd46ad7 commit f804d2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ async function _export({
// parse link rel=preload headers and embed them in the HTML
const link = parseLinkHeader(response.headers.get('Link') || '');
link.refs.forEach((ref: Ref) => {
if (ref.rel === 'preload') {
if (ref.rel === 'preload' || ref.rel === 'modulepreload') {
body = (body as string).replace('</head>',
`<link rel="preload" as=${JSON.stringify(ref.as)} href=${JSON.stringify(ref.uri)}></head>`);
`<link rel="preload" as=${JSON.stringify(ref.as)} href=${JSON.stringify(ref.uri)} ${ref.as === 'script' ? 'crossorigin="use-credentials"' : ''}></head>`);
}
});

Expand Down

0 comments on commit f804d2b

Please sign in to comment.