fix: Exclude scripts loaded with rel=modulepreload from snapshots (#1128)
* fix: Exclude `modulepreload` as well We were only excluding `<link rel="preload" as="script" />` but we should include `rel="modulepreload"` as well * Apply formatting changes
This commit is contained in:
@@ -221,7 +221,8 @@ function buildNode(
|
||||
continue;
|
||||
} else if (
|
||||
tagName === 'link' &&
|
||||
n.attributes.rel === 'preload' &&
|
||||
(n.attributes.rel === 'preload' ||
|
||||
n.attributes.rel === 'modulepreload') &&
|
||||
n.attributes.as === 'script'
|
||||
) {
|
||||
// ignore
|
||||
|
||||
@@ -813,9 +813,10 @@ function slimDOMExcluded(
|
||||
slimDOMOptions.script &&
|
||||
// script tag
|
||||
(sn.tagName === 'script' ||
|
||||
// preload link
|
||||
// (module)preload link
|
||||
(sn.tagName === 'link' &&
|
||||
sn.attributes.rel === 'preload' &&
|
||||
(sn.attributes.rel === 'preload' ||
|
||||
sn.attributes.rel === 'modulepreload') &&
|
||||
sn.attributes.as === 'script') ||
|
||||
// prefetch link
|
||||
(sn.tagName === 'link' &&
|
||||
|
||||
Reference in New Issue
Block a user