-
Notifications
You must be signed in to change notification settings - Fork 15
/
webpack.config.js
57 lines (55 loc) · 1.36 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
56
57
/* eslint-disable @typescript-eslint/camelcase */
const webpack = require('webpack')
const path = require('path')
const outPath = path.join(__dirname, './dist')
const sourcePath = path.join(__dirname, './src')
const CleanWebpackPlugin = require('clean-webpack-plugin')
module.exports = {
context: sourcePath,
entry: './server',
target: 'node',
mode: 'none',
output: {
path: outPath,
filename: 'bundle.js',
chunkFilename: '[chunkhash].js'
},
resolve: {
extensions: ['*', '.ts', '.js', '.json'],
modules: [
path.resolve(__dirname, 'src'),
'node_modules'
],
alias: {
'~': path.resolve(__dirname, 'src/')
}
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/
}
]
},
optimization: {
nodeEnv: false
},
plugins: [
new CleanWebpackPlugin(['dist']),
new webpack.IgnorePlugin(/^pg-native$|^hiredis$|^pg-hstore$|^tedious$|^spdx-expression-parse$|^spdx-correct$/),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
}
}