-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
52 lines (50 loc) · 1.38 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
"use strict";
const path = require("path");
const fs = require("fs");
const ModuleJsonWebpackPlugin = require("./webpack/module-json-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const FVTTMacroPackWebpackPlugin = require("./webpack/macro-pack-plugin");
let devDomain = "localhost";
if (fs.existsSync(".devDomain")) {
devDomain = fs.readFileSync(".devDomain");
}
module.exports = {
mode: process.env.NODE_ENV == "production" ? "production" : "development",
entry: "./src/js/index.js",
output: {
filename: "MindFlayer.js",
path: path.resolve(
__dirname,
process.env.NODE_ENV == "production"
? "dist"
: "chrome-overrides/" +
devDomain +
"/modules/mindflayer-token-controller"
),
},
plugins: [
new CopyPlugin({
patterns: [
{ from: "src/lang", to: "lang" },
{ from: "src/templates", to: "templates" },
{ from: "LICENSE", to: "." },
{ from: "src/style.css", to: "style.css" },
],
}),
new ModuleJsonWebpackPlugin(),
new FVTTMacroPackWebpackPlugin(),
],
optimization: {
minimize: process.env.NODE_ENV == "production",
minimizer: [
new TerserPlugin({
terserOptions: {
keep_classnames: true,
keep_fnames: true,
},
}),
],
},
devtool: "source-map",
};