Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-plugin-manifest): generate icons sequentially #34331

Merged
merged 1 commit into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`) {
wardpeet marked this conversation as resolved.
Show resolved Hide resolved
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