-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.ts
executable file
·56 lines (52 loc) · 1.38 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
import configuration from 'config'
import glob from 'glob';
import path from 'path';
import webpack from 'webpack';
const webpackConfig: any = configuration.get("webpack")
const outputDir = webpackConfig.outputDir;
const config: webpack.Configuration = {
mode: 'production',
entry: glob.sync('./src/*.ts').reduce((acc, file) => {
return {...acc, [file.substring(6, file.length - 3)]: file}
}, {}),
target: "node",
output: {
filename: '[name].js',
libraryTarget: 'commonjs',
path: path.resolve(__dirname, outputDir)
},
optimization: {
// We no not want to minimize our code.
minimize: false,
// TODO: Find out how to not inline dependencies
// splitChunks: {
// chunks: 'all',
// maxInitialRequests: Infinity,
// minSize: 0
// }
},
module: {
rules: [
{
test: /\.[tj]s(on)?$/,
use: {
loader: 'ts-loader',
options: { allowTsInNodeModules: true }
}
}
]
},
resolve: {
extensions: ['.ts', '.js', '.json'],
alias: {
lib: path.resolve(__dirname, './lib/')
}
},
externals: {
'lib/lodash': 'commonjs lib/lodash'
},
plugins: [
new webpack.NamedModulesPlugin()
]
}
export default config