-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.ts
47 lines (44 loc) · 1.2 KB
/
rollup.config.ts
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
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import nodeResolve from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
import typescript from "@rollup/plugin-typescript";
import path from "node:path";
import url from "node:url";
import { RollupOptions } from "rollup";
const isWatching = !!process.env.ROLLUP_WATCH;
const config: RollupOptions = {
input: "src/index.ts",
output: {
banner: "#!/usr/bin/env node",
file: "bin/streamdeck.mjs",
sourcemap: isWatching,
sourcemapPathTransform: (relativeSourcePath: string, sourcemapPath: string): string => {
return url.pathToFileURL(path.resolve(path.dirname(sourcemapPath), relativeSourcePath)).href;
}
},
external: [
/* Ignore @elgato/schema to enable auto-update. */
"@elgato/schemas",
"@elgato/schemas/streamdeck/plugins/",
"@elgato/schemas/streamdeck/plugins/layout.json",
"@elgato/schemas/streamdeck/plugins/manifest.json"
],
plugins: [
typescript(),
json(),
commonjs(),
nodeResolve({
browser: false,
exportConditions: ["node"],
preferBuiltins: true
}),
!isWatching &&
terser({
format: {
comments: false
}
})
]
};
export default config;