Skip to content

Commit

Permalink
fix(gatsby-plugin-manifest): generate icons sequentially (#34331)
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed Jan 10, 2022
1 parent f95be79 commit 024d298
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
8 changes: 7 additions & 1 deletion packages/gatsby-plugin-manifest/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"presets": [["babel-preset-gatsby-package", { "browser": true }]]
"presets": [["babel-preset-gatsby-package"]],
"overrides": [
{
"test": ["**/gatsby-browser.js"],
"presets": [["babel-preset-gatsby-package", { "browser": true, "esm": true }]]
}
]
}
7 changes: 5 additions & 2 deletions packages/gatsby-plugin-manifest/src/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import { withPrefix } from "gatsby"
import getManifestForPathname from "./get-manifest-pathname"

// when we don't have localisation in our manifest, we tree shake everything away
if (__MANIFEST_PLUGIN_HAS_LOCALISATION__) {
exports.onRouteUpdate = function ({ location }, pluginOptions) {
export const onRouteUpdate = function onRouteUpdate(
{ location },
pluginOptions
) {
if (__MANIFEST_PLUGIN_HAS_LOCALISATION__) {
const { localize } = pluginOptions
const manifestFilename = getManifestForPathname(
location.pathname,
Expand Down
16 changes: 6 additions & 10 deletions packages/gatsby-plugin-manifest/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,9 @@ const makeManifest = async ({
async function processIconSet(iconSet) {
// if cacheBusting is being done via url query icons must be generated before cache busting runs
if (cacheMode === `query`) {
await Promise.all(
iconSet.map(dstIcon =>
checkCache(cache, dstIcon, icon, iconDigest, generateIcon)
)
)
for (const dstIcon of iconSet) {
await checkCache(cache, dstIcon, icon, iconDigest, generateIcon)
}
}

if (cacheMode !== `none`) {
Expand All @@ -237,11 +235,9 @@ const makeManifest = async ({

// if file names are being modified by cacheBusting icons must be generated after cache busting runs
if (cacheMode !== `query`) {
await Promise.all(
iconSet.map(dstIcon =>
checkCache(cache, dstIcon, icon, iconDigest, generateIcon)
)
)
for (const dstIcon of iconSet) {
await checkCache(cache, dstIcon, icon, iconDigest, generateIcon)
}
}

return iconSet
Expand Down

0 comments on commit 024d298

Please sign in to comment.