-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
58 lines (55 loc) · 1.1 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
import * as path from 'path';
import * as webpack from 'webpack';
const webpackNodeExternals = require('webpack-node-externals');
const clientConfig: webpack.Configuration = {
mode: 'development',
entry: {
home: './src/client/home.tsx',
games: './src/client/games.tsx',
error: './src/client/error.tsx',
admin: './src/client/admin.tsx',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'static'),
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
},
target: ['web', 'es2020'],
};
const serverConfig: webpack.Configuration = {
mode: 'development',
entry: {
init: './src/server/init.ts',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'app'),
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
},
externals: [webpackNodeExternals()],
devtool: 'source-map',
target: 'node',
};
module.exports = [clientConfig, serverConfig];