Skip to content

Commit

Permalink
fix(gatsby-plugin-offline): Drop preload link for json from offline s…
Browse files Browse the repository at this point in the history
…hell (#13935)
  • Loading branch information
hupe1980 authored and sidharthachatterjee committed May 17, 2019
1 parent 5d662de commit d1f0ae6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/gatsby-plugin-offline/src/gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export const onPreRenderHTML = ({
getHeadComponents,
pathname,
replaceHeadComponents,
}) => {
if (pathname !== `/offline-plugin-app-shell-fallback/`) return

const headComponents = getHeadComponents()

const filteredHeadComponents = headComponents.filter(
({ type, props }) =>
!(
type === `link` &&
props.as === `fetch` &&
props.rel === `preload` &&
props.href.startsWith(`/static/d/`)
)
)

replaceHeadComponents(filteredHeadComponents)
}

0 comments on commit d1f0ae6

Please sign in to comment.