-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
55 lines (53 loc) · 1.73 KB
/
webpack.config.js
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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const WebpackShellPlugin = require('webpack-shell-plugin');
const { NODE_ENV = 'production' } = process.env;
module.exports = {
entry: './src/server.ts',
mode: NODE_ENV,
target: 'node',
watch: NODE_ENV === 'development',
externals: [nodeExternals()],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'server.js',
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
'@app': path.resolve('src/app.ts'),
'@config': path.resolve('src/config.ts'),
'@launchApi': path.resolve('src/data/api/LaunchApi.ts'),
'@userRepo': path.resolve('src/data/db/UserRepository.ts'),
'@core': path.resolve('src/core/'),
'@utils': path.resolve('src/utils.ts'),
'@resolvers': path.resolve('src/resolvers/'),
'@gql': path.resolve('src/gql/'),
'@launchResolver': path.resolve('src/gql/launch/launchResolver.ts'),
'@missionResolver': path.resolve('src/gql/mission/missionResolver.ts'),
'@mutationResolver': path.resolve('src/gql/mutation/mutationResolver.ts'),
'@queryResolver': path.resolve('src/gql/query/queryResolver.ts'),
'@userResolver': path.resolve('src/gql/user/userResolver.ts'),
'@logger': path.resolve('src/core/logger.ts'),
'@cache': path.resolve('src/core/cache.ts'),
'@context': path.resolve('src/core/context.ts'),
},
},
plugins:
NODE_ENV === 'production'
? []
: [
new WebpackShellPlugin({
onBuildEnd: ['yarn watch'],
}),
],
module: {
rules: [
{
test: /\.ts$/,
use: ['ts-loader'],
},
],
},
};