-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
42 lines (38 loc) · 979 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
require("dotenv").config();
const { resolve } = require("path");
const { readdirSync, lstatSync } = require("fs");
const MaxForLivePlugin = require("./src/webpack/MaxForLivePlugin");
const { OUTPUT_PATH } = process.env;
const path = OUTPUT_PATH.startsWith("/")
? OUTPUT_PATH
: resolve(__dirname, OUTPUT_PATH);
const objectsDir = resolve(__dirname, "./src/objects");
const entry = readdirSync(objectsDir)
.filter((curr) => lstatSync(resolve(objectsDir, curr)).isDirectory())
.reduce((acc, curr) => ({ ...acc, [curr]: resolve(objectsDir, curr) }), {});
module.exports = {
entry,
output: {
library: "[name]",
filename: "[name].js",
path,
},
module: {
rules: [
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".ts", ".js"],
},
optimization: {
minimize: false,
},
mode: "production",
plugins: [new MaxForLivePlugin()],
target: "node4",
};