Skip to content

Commit

Permalink
fix(gatsby-transform-url): inconsistency between src and srcWebp caus…
Browse files Browse the repository at this point in the history
…ed by imgix-core-js bug:

imgix/js-core#158
  • Loading branch information
frederickfogerty committed Aug 27, 2020
1 parent fa5eac8 commit c8f39ad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/gatsby-transform-url/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ function buildImageData(
ar: imgixParams.ar != null ? `${imgixParams.ar}:1` : undefined,
};

const src = client.buildURL(path, transformedImgixParams);
const srcset = client.buildSrcSet(path, transformedImgixParams);
// We have to spread parameters because imgix-core-js builders mutate params. GH issue: https://github.com/imgix/imgix-core-js/issues/158
const src = client.buildURL(path, {
...transformedImgixParams,
});
const srcset = client.buildSrcSet(path, {
...transformedImgixParams,
});
const srcWebp = client.buildURL(path, {
...transformedImgixParams,
fm: 'webp',
Expand Down

0 comments on commit c8f39ad

Please sign in to comment.