-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
64 lines (56 loc) · 1.51 KB
/
webpack.config.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import * as path from "path";
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
import HtmlWebpackPlugin from "html-webpack-plugin";
import template from "html-webpack-template";
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
import { GraphQLCodegenWebpackPlugin } from "graphql-codegen-webpack-plugin";
import { GraphqlSchemaCreator } from "./src/api/interop/GraphqlSchemaCreator";
const config = {
mode: "development",
context: path.resolve(__dirname, "src"),
entry: ["./bootstrap"],
output: {
path: path.resolve(__dirname, "./public"),
publicPath: "/",
filename: "[name].js",
libraryTarget: "umd",
globalObject: "this",
},
devtool: "eval",
resolve: {
extensions: [".ts", ".tsx", ".mjs", ".js"],
plugins: [new TsconfigPathsPlugin({})],
alias: {
fs: "memfs",
[require.resolve("type-graphql/dist/helpers/loadResolversFromGlob.js")]:
false,
},
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: "ts-loader",
},
],
},
devServer: {
contentBase: path.join(__dirname, "./public"),
historyApiFallback: true,
port: 4000,
},
plugins: [
new NodePolyfillPlugin(),
new HtmlWebpackPlugin({
template,
title: "Client-side GraphQL",
appMountId: "app",
}),
new GraphqlSchemaCreator(),
new GraphQLCodegenWebpackPlugin({
configPath: path.resolve(__dirname, "./codegen.json"),
}),
],
};
export default config;