-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.js
59 lines (52 loc) · 1.18 KB
/
rollup.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
import replace from "@rollup/plugin-replace";
import typescript from "@rollup/plugin-typescript";
import getPath from "platform-folders";
import { terser } from "rollup-plugin-terser";
import pkg from "./package.json";
// Environment variables
const build = process.env.BUILD || "development";
const isDev = (build === "development");
const output = (isDev)
? `${getPath("documents")}/OpenRCT2/plugin/PeepEditor_alpha.js`
: "./dist/PeepEditor.js";
/**
* @type {import("rollup").RollupOptions}
*/
const config = {
input: "./src/registerPlugin.ts",
output: {
file: output,
format: "iife",
},
plugins: [
replace({
include: "./src/helpers/environment.ts",
preventAssignment: true,
values: {
__PLUGIN_VERSION__: pkg.version,
__BUILD_CONFIGURATION__: build
}
}),
typescript(),
terser({
compress: {
passes: 5
},
format: {
comments: false,
quote_style: 1,
wrap_iife: true,
preamble: "// Get the latest version: https://github.com/Manticore-007/OpenRCT2-PeepEditor",
beautify: true,
},
mangle: {
properties: {
regex: /^_/
}
},
// Useful only for stacktraces:
keep_fnames: isDev,
}),
],
};
export default config;