-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
40 lines (38 loc) · 1005 Bytes
/
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
const { resolve } = require('path');
const nodeExternals = require('webpack-node-externals');
const tsconfig = require('./tsconfig.json');
const parseKey = key => key.match(/(@.*)\/\*$/)[1];
const parsePath = path => resolve('src/', path.replace(/\*$/, ''));
const mapModuleAlias = () => {
const { paths } = tsconfig.compilerOptions;
const entries = Object.entries(paths);
return entries.reduce((results, [key, [path]]) => {
Object.assign(results, {
[parseKey(key)]: parsePath(path),
});
return results;
}, {});
};
module.exports = {
mode: 'production',
entry: { main: './src/core/infrastructure/http/server.ts' },
target: 'node',
stats: 'errors-only',
plugins: [],
resolve: {
alias: mapModuleAlias(),
extensions: ['.ts', '.mjs', '.js'],
},
optimization: {
minimize: false,
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
},
],
},
externals: ['utf-8-validate', 'bufferutil', nodeExternals()],
};