Skip to content

Commit d1f0ae6

Browse files
hupe1980sidharthachatterjee
authored andcommitted
fix(gatsby-plugin-offline): Drop preload link for json from offline shell (#13935)
1 parent 5d662de commit d1f0ae6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export const onPreRenderHTML = ({
2+
getHeadComponents,
3+
pathname,
4+
replaceHeadComponents,
5+
}) => {
6+
if (pathname !== `/offline-plugin-app-shell-fallback/`) return
7+
8+
const headComponents = getHeadComponents()
9+
10+
const filteredHeadComponents = headComponents.filter(
11+
({ type, props }) =>
12+
!(
13+
type === `link` &&
14+
props.as === `fetch` &&
15+
props.rel === `preload` &&
16+
props.href.startsWith(`/static/d/`)
17+
)
18+
)
19+
20+
replaceHeadComponents(filteredHeadComponents)
21+
}

0 commit comments

Comments
 (0)