-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.ts
33 lines (29 loc) · 973 Bytes
/
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
import { config as federationConfig } from "./config/federation";
import { container } from "webpack";
import {
CreateWebpackConfigArgs,
CreateNodeArgs,
CreateSchemaCustomizationArgs,
} from "gatsby";
import createGraphqlTypes from "./src/gatsby-node/createGraphqlTypes";
import exportStaticJsonFiles from "./src/gatsby-node/exportStaticJsonFiles";
import createIndexableNodes from "./src/gatsby-node/createIndexableNodes";
export function onCreateWebpackConfig({
stage,
actions: { setWebpackConfig },
}: CreateWebpackConfigArgs) {
if (stage === "build-html" || stage === "develop-html") {
setWebpackConfig({
plugins: [new container.ModuleFederationPlugin(federationConfig)],
});
}
}
export function createSchemaCustomization(args: CreateSchemaCustomizationArgs) {
createGraphqlTypes(args);
}
export function onCreateNode(args: CreateNodeArgs) {
createIndexableNodes(args);
}
export function onPostBuild() {
exportStaticJsonFiles();
}