forked from frazazel/goorbo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
78 lines (73 loc) · 2.29 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* eslint-env node */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require("path");
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const webpack = require("webpack"); // does this have a purpose? or can it just get deleted?
const packageData = require("./package.json");
const { merge } = require("webpack-merge");
/* eslint-enable @typescript-eslint/no-var-requires */
const shared = {
// Turns on tree-shaking and minification in the default Terser minifier
// https://webpack.js.org/plugins/terser-webpack-plugin/
mode: "production",
devtool: false,
output: {
filename: "[name].js",
libraryTarget: "commonjs",
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
},
module: {
rules: [
{
// Include ts, tsx, js, and jsx files.
test: /\.(ts|js)x?$/,
// exclude: /node_modules/,
loader: "babel-loader",
},
],
},
optimization: {
// Disable compression because it makes debugging more difficult for KolMafia
minimize: false,
},
performance: {
// Disable the warning about assets exceeding the recommended size because this isn't a website script
hints: false,
},
plugins: [],
externals: {
// Necessary to allow kolmafia imports.
kolmafia: "commonjs kolmafia",
// Add any ASH scripts you would like to use here to allow importing. E.g.:
// "canadv.ash": "commonjs canadv.ash",
},
};
const entry = merge(
{
entry: {
// Define files webpack will emit, does not need to correspond 1:1 with every typescript file
// You need an emitted file for each entrypoint into your code, e.g. the main script and the ccs or ccs consult script it calls
smolisgarbage: "./src/main.ts",
},
output: {
path: path.resolve(__dirname, "KoLmafia", "scripts", packageData.name),
},
},
shared
);
const relay = merge(
{
entry: {
// Define files webpack will emit, does not need to correspond 1:1 with every typescript file
// You need an emitted file for each entrypoint into your code, e.g. the main script and the ccs or ccs consult script it calls
relay_smolisgarbage: "./src/relay.ts",
},
output: {
path: path.resolve(__dirname, "KoLmafia", "relay"),
},
},
shared
);
module.exports = [entry, relay];