-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.ts
41 lines (37 loc) · 1.04 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 ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import type { CreateBabelConfigArgs, CreateWebpackConfigArgs } from 'gatsby';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { defineOptions, resolveAlias } = require('./.config/webpack.config');
exports.onCreateBabelConfig = ({ actions }: CreateBabelConfigArgs) => {
actions.setBabelPlugin({
name: '@babel/plugin-transform-react-jsx',
options: {
runtime: 'automatic',
},
});
};
exports.onCreateWebpackConfig = ({
stage,
plugins,
getConfig,
actions,
}: CreateWebpackConfigArgs) => {
const config = getConfig();
actions.setWebpackConfig({
plugins: [
plugins.define(defineOptions(stage)),
new ForkTsCheckerWebpackPlugin({
async: true,
issue: {
include: {
severity: process.env.NODE_ENV === 'development' ? 'error' : 'warning',
},
},
}),
],
resolve: {
...config.resolve,
alias: { ...config.resolve.alias, ...resolveAlias },
},
});
};