-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.tampermonkey.js
59 lines (56 loc) · 1.58 KB
/
webpack.tampermonkey.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
const common = require("./webpack.common");
const { merge } = require('webpack-merge');
const packageJson = require("./package.json");
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
const webpack = require("webpack");
const downloadUrl = "https://raw.githubusercontent.com/p-toy-factory/fuego-hud/main/dist/index.user.js";
const updateUrl = downloadUrl
const banner = [
"// ==UserScript==",
"// @name FuegoHud",
`// @author ${packageJson.author}`,
`// @description ${packageJson.description}`,
`// @downloadURL ${downloadUrl}`,
`// @updateURL ${updateUrl}`,
"// @grant none",
`// @homepage ${packageJson.homepage}`,
`// @license ${packageJson.license}`,
"// @match *://*/*",
`// @supportURL ${packageJson.bugs.url}`,
"// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/bundles/rxjs.umd.min.js",
"// @run-at document-body",
`// @version ${packageJson.version}`,
"// ==/UserScript==",
].join("\n");
module.exports = merge(common, {
mode: "production",
entry: "./src/index.ts",
externals: {
rxjs: "rxjs",
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
beautify: true,
comments: /==\/?UserScript==|^[ ]?@/,
indent_level: 2,
},
},
}),
],
},
output: {
filename: "index.user.js",
path: path.resolve(__dirname, "dist"),
},
plugins: [
new webpack.BannerPlugin({
raw: true,
banner,
})
],
});