Skip to content

Commit

Permalink
check rel external
Browse files Browse the repository at this point in the history
  • Loading branch information
v1ack committed Jun 28, 2021
1 parent 6fd9a74 commit f586d88
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/kit/src/core/adapt/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ function get_src(attrs) {
}

/** @param {string} attrs */
function get_rel(attrs) {
const match = /rel\s*=\s*(?:"(.*?)"|'(.*?)'|([^\s>]*))/.exec(attrs);
return match && (match[1] || match[2] || match[3]);
function is_rel_external(attrs) {
const match = /rel\s*=\s*(?:["'][^>]*(external)[^>]*["']|(external))/.exec(attrs);
return !!match;
}

/** @param {string} attrs */
Expand Down Expand Up @@ -205,8 +205,7 @@ export async function prerender({ cwd, out, log, config, build_data, fallback, a
const attrs = match[2];

if (element === 'a' || element === 'link') {
const rel = get_rel(attrs);
if (rel === 'external') continue;
if (is_rel_external(attrs)) continue;

hrefs.push(get_href(attrs));
} else {
Expand Down

0 comments on commit f586d88

Please sign in to comment.