diff --git a/packages/rrweb-snapshot/src/rebuild.ts b/packages/rrweb-snapshot/src/rebuild.ts index 854d6c957b..1582104a45 100644 --- a/packages/rrweb-snapshot/src/rebuild.ts +++ b/packages/rrweb-snapshot/src/rebuild.ts @@ -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 diff --git a/packages/rrweb-snapshot/src/snapshot.ts b/packages/rrweb-snapshot/src/snapshot.ts index 99a23ff7be..e8078388a7 100644 --- a/packages/rrweb-snapshot/src/snapshot.ts +++ b/packages/rrweb-snapshot/src/snapshot.ts @@ -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' && diff --git a/packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap b/packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap index 448823cbce..529a51eeff 100644 --- a/packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap +++ b/packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap @@ -370,6 +370,7 @@ exports[`integration tests [html file]: preload.html 1`] = `