-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
43 lines (38 loc) · 1.03 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
// eslint-disable-next-line @typescript-eslint/no-var-requires
var nodeExternals = require('webpack-node-externals');
module.exports = (env) => {
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs');
const path = require('path');
const RELEASE = env.release;
const nodeModules = {};
fs.readdirSync('./node_modules')
.filter((x) => ['.bin', 'common'].indexOf(x) === -1)
.forEach((mod) => (nodeModules[mod] = `commonjs ${mod}`));
return {
target: 'node',
mode: RELEASE ? 'production' : 'development',
entry: './src/index.ts',
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
}
],
},
resolve: {
extensions: ['.js', '.ts'],
},
externals: [nodeExternals()],
output: {
filename: 'index.js',
path: path.join(__dirname, 'build'),
},
plugins: [
// fix for moment bundle size issues on include locale
],
};
};