-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
42 lines (40 loc) · 1002 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
41
42
const path = require('path')
const readdirRecursive = require('fs-readdir-recursive')
const config = require('./config')
const files = readdirRecursive(config.JS_SOURCE_DIR);
const entry = {};
files.forEach(function(value) {
if (value.endsWith('.ts')) {
const key = value.substring(0, value.length - 3);
entry[key] = config.JS_SOURCE_DIR + value;
} else if (value.endsWith('.tsx')) {
const key = value.substring(0, value.length - 4);
entry[key] = config.JS_SOURCE_DIR + value;
}
});
module.exports = {
entry: entry,
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
mode: 'development',
devtool: "eval",
plugins: [],
module: {
rules: [
{
test: /\.tsx?$/,
include: [
path.resolve(__dirname, 'source/js'),
],
use: ['ts-loader'],
exclude: /node_modules/,
}
],
},
output: {
path: path.resolve(__dirname, config.JS_OUT_DIR),
filename: '[name].min.js',
},
watch: true,
};