-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathwebpack.config.ts
45 lines (41 loc) · 965 Bytes
/
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
import * as webpack from 'webpack';
import nodeExternals from 'webpack-node-externals';
import path from 'path';
const IS_DEV = process.env.NODE_ENV !== 'production';
const config: webpack.Configuration = {
mode: IS_DEV ? 'development' : 'production',
entry: {
index: './src/index.ts',
types: './src/types.ts',
...(IS_DEV ? {cli: 'src/cli/index'} : {}),
},
target: 'node',
externals: [nodeExternals() as any],
output: {
path: path.resolve(__dirname, 'lib'),
filename: '[name].js',
libraryTarget: 'commonjs2',
},
optimization: {
minimize: false,
},
resolve: {
extensions: ['.ts', '.js'],
alias: {src: path.join(__dirname, 'src')},
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.ksy$/,
use: ['kaitai-struct-loader'],
},
{
test: /\.ts$/,
exclude: /node_modules/,
loader: 'ts-loader',
},
],
},
};
export default config;