-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
46 lines (42 loc) · 1 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
const path = require('path');
// const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const glob = require('glob');
const {
NODE_ENV = 'development',
} = process.env;
const entryArray = glob.sync('./app/src/{index,modules/}*.?(m)js');
const entryObject = entryArray.reduce((acc, item) => {
// if (item.indexOf('config.js') !== -1) { return acc; }
const name = item.replace('./app/src/', '');
acc[name] = item;
return acc;
}, {});
console.log(entryObject);
module.exports = {
mode: NODE_ENV,
target: 'node',
externals: [nodeExternals()],
entry: entryObject,
devtool: 'inline-source-map',
module: {
rules: [
{
enforce: 'pre',
test: /\.tsx?$/,
loader: 'eslint-loader',
}, {
test: /\.tsx?$/,
use: 'ts-loader',
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
// output: '[name]/main.js',
output: {
path: path.resolve(__dirname, './app/build/'),
filename: '[name]',
},
};