-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-node.ts
41 lines (36 loc) · 1.09 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
import type { CreateDevServerArgs, CreateWebpackConfigArgs } from "gatsby";
import type { Configuration } from "webpack";
import type { Application } from "express";
export function onCreateWebpackConfig(opts: CreateWebpackConfigArgs) {
console.info({ "GATSBY STAGE": opts.stage, NODE_ENV: process.env.NODE_ENV });
const cfg: Configuration = {
module: {
rules: [
// { test: /\/raw-loader.js$/, use: 'raw-loader' },
],
},
resolve: {
alias: {},
fallback: {
child_process: false,
fs: false,
path: false,
stream: false,
util: false,
},
},
};
opts.actions.setWebpackConfig(cfg);
// opts.actions.setBabelOptions({
// options: {
// compact: true,
// plugins: ["@babel/plugin-transform-async-generator-functions"],
// presets: ["babel-preset-gatsby"],
// ignore: ["./src/npc-cli/sh/src"],
// },
// });
}
export function onCreateDevServer(args: CreateDevServerArgs) {
const app = args.app as Application;
app.get("/hello", (req, res) => res.json({ greetings: "human" }));
}