This repository has been archived by the owner on Apr 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.ts
87 lines (83 loc) · 1.81 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import webpack from "webpack";
import path from "path";
import CleanWebpackPlugin from "clean-webpack-plugin";
import HtmlWebpackPlugin from "html-webpack-plugin";
const cwd = process.cwd();
const src = path.resolve(cwd, "src");
const dist = path.resolve(cwd, "dist");
const port = 3001;
const config: webpack.Configuration = {
entry: {
app: src,
vendors: [
"react",
"react-dom",
"react-router-dom",
"react-apollo",
"apollo-cache-inmemory",
"apollo-client",
"apollo-link",
"apollo-link-context",
"apollo-link-error",
"apollo-link-http",
"apollo-link-http-common",
"apollo-link-schema",
"apollo-link-state",
"apollo-link-ws",
"apollo-upload-client",
"apollo-utilities",
"graphql",
"graphql-tag",
"subscriptions-transport-ws"
]
},
output: {
path: dist,
filename: "[name].js",
publicPath: "/",
pathinfo: true
},
resolve: {
alias: {
gqlMod: path.resolve(src, "graphql"),
services: path.resolve(src, "services"),
types: path.resolve(src, "types")
},
extensions: [".tsx", ".ts", ".mjs", ".js"]
},
devtool: "inline-source-map",
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
},
{
test: /\.(ts|tsx)$/,
include: [src],
use: "ts-loader"
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
use: "graphql-tag/loader"
}
]
},
plugins: [
new CleanWebpackPlugin(dist),
new HtmlWebpackPlugin({
template: src + "/index.html"
})
],
devServer: {
contentBase: dist,
port
}
};
export default config;