diff --git a/packages/gatsby-plugin-offline/src/gatsby-ssr.js b/packages/gatsby-plugin-offline/src/gatsby-ssr.js new file mode 100644 index 0000000000000..0272af166ae8d --- /dev/null +++ b/packages/gatsby-plugin-offline/src/gatsby-ssr.js @@ -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) +}