-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.server.js
44 lines (42 loc) · 1010 Bytes
/
webpack.server.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
const { resolve } = require('path');
const nodeExternals = require('webpack-node-externals');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const rootResolve = pathname => resolve(__dirname, pathname);
module.exports = {
entry: './server/index.ts',
mode: 'production',
optimization: {
minimize: false,
},
output: {
path: rootResolve('build'),
filename: 'server.js',
},
target: 'node',
externals: [nodeExternals()],
module: {
rules: [
{
test: /\.ts|\.tsx$/,
exclude: /node_modules/,
use: [{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
}],
},
],
},
plugins: [
new CleanWebpackPlugin(),
new ForkTsCheckerWebpackPlugin(),
],
resolve: {
extensions: ['*', '.js', '.json', '.jsx', '.d.ts', '.ts', '.tsx'],
alias: {
'@': rootResolve('.'),
},
},
};