Skip to content

Commit

Permalink
fix(gatsby-source-drupal): add image cdn support for files type and…
Browse files Browse the repository at this point in the history
… `typePrefix` (#38057)
  • Loading branch information
ascorbic committed May 5, 2023
1 parent e5e2bb7 commit dfdeed4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/gatsby-source-drupal/src/gatsby-node.ts
Expand Up @@ -21,6 +21,7 @@ import {
downloadFile,
isFileNode,
imageCDNState,
generateTypeName,
} from "./normalize"

import {
Expand Down Expand Up @@ -951,10 +952,22 @@ exports.createSchemaCustomization = (
if (pluginOptions.skipFileDownloads && pluginOptions.imageCDN) {
actions.createTypes([
// polyfill so image CDN works on older versions of Gatsby
// this type is merged in with the inferred file__file and files types, adding Image CDN support via the gatsbyImage GraphQL field. The `RemoteFile` interface as well as the polyfill above are what add the gatsbyImage field.
addRemoteFilePolyfillInterface(
// this type is merged in with the inferred file__file type, adding Image CDN support via the gatsbyImage GraphQL field. The `RemoteFile` interface as well as the polyfill above are what add the gatsbyImage field.
schema.buildObjectType({
name: `file__file`,
name: generateTypeName(`file--file`, pluginOptions.typePrefix),
fields: {},
interfaces: [`Node`, `RemoteFile`],
}),
{
schema,
actions,
store,
}
),
addRemoteFilePolyfillInterface(
schema.buildObjectType({
name: generateTypeName(`files`, pluginOptions.typePrefix),
fields: {},
interfaces: [`Node`, `RemoteFile`],
}),
Expand Down

0 comments on commit dfdeed4

Please sign in to comment.