-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.ts
44 lines (41 loc) · 1.03 KB
/
gatsby-node.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { createPages } from "@lekoarts/gatsby-theme-cara/gatsby-node.mjs";
import { createRemoteFileNode } from "gatsby-source-filesystem";
import { GatsbyNode } from "gatsby";
import path from "path";
import { copyLibFiles } from "@builder.io/partytown/utils";
export const onPreBuild = async () => {
await copyLibFiles(path.join(__dirname, "static", "~partytown"));
};
export const createResolvers: GatsbyNode["createResolvers"] = ({
actions,
cache,
createNodeId,
createResolvers,
store,
reporter,
}) => {
const { createNode } = actions;
createResolvers({
Query: {
remoteImage: {
type: "File",
args: {
url: {
type: "String",
description: "URL of the image",
},
},
resolve: async (_: any, { url }: { url: string }) => {
return await createRemoteFileNode({
url,
store,
cache,
createNode,
createNodeId,
reporter,
});
},
},
},
});
};