|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+const path = require('path');
|
|
|
2
|
+const TerserPlugin = require('terser-webpack-plugin');
|
|
|
3
|
+
|
|
|
4
|
+
|
|
|
5
|
+const frontendConf = {
|
|
|
6
|
+ mode: 'production',
|
|
|
7
|
+ target: "web",
|
|
|
8
|
+ output: {
|
|
|
9
|
+ path: path.resolve(__dirname, 'lib'),
|
|
|
10
|
+ libraryTarget: 'commonjs',
|
|
|
11
|
+ },
|
|
|
12
|
+ module: {
|
|
|
13
|
+ rules: [
|
|
|
14
|
+ { test: /\.ts?$/, loader: "ts-loader" }
|
|
|
15
|
+ ]
|
|
|
16
|
+ },
|
|
|
17
|
+ resolve: {
|
|
|
18
|
+ extensions: [".ts", ".tsx", ".js"]
|
|
|
19
|
+ },
|
|
|
20
|
+ optimization: {
|
|
|
21
|
+ minimize: true,
|
|
|
22
|
+ minimizer: [
|
|
|
23
|
+ new TerserPlugin({
|
|
|
24
|
+ parallel: true,
|
|
|
25
|
+ exclude: [
|
|
|
26
|
+ /\.\/(.*)\/.ts/,
|
|
|
27
|
+ /\.\/(.*).ts/,
|
|
|
28
|
+ ],
|
|
|
29
|
+ }),
|
|
|
30
|
+ ],
|
|
|
31
|
+ },
|
|
|
32
|
+}
|
|
|
33
|
+
|
|
|
34
|
+const backendConf = {
|
|
|
35
|
+mode: 'production',
|
|
|
36
|
+target: "node",
|
|
|
37
|
+output: {
|
|
|
38
|
+ path: path.resolve(__dirname, 'lib'),
|
|
|
39
|
+ libraryTarget: 'commonjs',
|
|
|
40
|
+},
|
|
|
41
|
+module: {
|
|
|
42
|
+ rules: [
|
|
|
43
|
+ { test: /\.ts?$/, loader: "ts-loader" }
|
|
|
44
|
+ ]
|
|
|
45
|
+},
|
|
|
46
|
+resolve: {
|
|
|
47
|
+ extensions: [".ts", ".tsx", ".js"]
|
|
|
48
|
+},
|
|
|
49
|
+optimization: {
|
|
|
50
|
+ minimize: true,
|
|
|
51
|
+ minimizer: [
|
|
|
52
|
+ new TerserPlugin({
|
|
|
53
|
+ parallel: true,
|
|
|
54
|
+ exclude: [
|
|
|
55
|
+ /\.\/(.*)\/.ts/,
|
|
|
56
|
+ /\.\/(.*).ts/,
|
|
|
57
|
+ ],
|
|
|
58
|
+ }),
|
|
|
59
|
+ ],
|
|
|
60
|
+},
|
|
|
61
|
+}
|
|
|
62
|
+
|
|
|
63
|
+const clientConf = {
|
|
|
64
|
+ ...frontendConf,
|
|
|
65
|
+ ...{
|
|
|
66
|
+ entry: path.resolve(__dirname, 'src', 'Client.ts'),
|
|
|
67
|
+ output: {
|
|
|
68
|
+ filename: 'Frontend.js',
|
|
|
69
|
+ }
|
|
|
70
|
+ }
|
|
|
71
|
+}
|
|
|
72
|
+const clientTestConf = {
|
|
|
73
|
+ ...frontendConf,
|
|
|
74
|
+ ...{
|
|
|
75
|
+ entry: path.resolve(__dirname, 'test', 'TestClient.ts'),
|
|
|
76
|
+ output: {
|
|
|
77
|
+ filename: 'TestFrontend.js',
|
|
|
78
|
+ }
|
|
|
79
|
+ }
|
|
|
80
|
+}
|
|
|
81
|
+
|
|
|
82
|
+const serverConf = {
|
|
|
83
|
+ ...backendConf,
|
|
|
84
|
+ ...{
|
|
|
85
|
+ entry: path.resolve(__dirname, 'src', 'Server.ts'),
|
|
|
86
|
+ output: {
|
|
|
87
|
+ filename: 'Backend.js',
|
|
|
88
|
+ }
|
|
|
89
|
+ }
|
|
|
90
|
+}
|
|
|
91
|
+const serverTestConf = {
|
|
|
92
|
+ ...backendConf,
|
|
|
93
|
+ ...{
|
|
|
94
|
+ entry: path.resolve(__dirname, 'test', 'TestServer.ts'),
|
|
|
95
|
+ output: {
|
|
|
96
|
+ filename: 'TestBackend.js',
|
|
|
97
|
+ }
|
|
|
98
|
+ }
|
|
|
99
|
+}
|
|
|
100
|
+
|
|
|
101
|
+module.exports = [clientConf, clientTestConf, serverConf, serverTestConf]
|