-
Notifications
You must be signed in to change notification settings - Fork 1
/
tsup.config.ts
45 lines (42 loc) · 940 Bytes
/
tsup.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
// eslint-disable-next-line import/no-unresolved
import { userscript } from "esbuild-plugin-userscript"
import { defineConfig } from "tsup"
import pkg from "@root/package.json" assert { type: "json" }
const dev = process.env.ENVIRONMENT === "development"
const metadata = {
name: pkg.name,
author: pkg.author,
description: pkg.description,
license: pkg.license,
version: pkg.version,
namespace: pkg.homepage,
match: pkg.homepage,
"run-at": "document-body",
connect: [],
grant: [],
}
// eslint-disable-next-line import/no-default-export
export default defineConfig({
entry: ["src/index.ts"],
format: "iife",
target: "es6",
bundle: true,
outDir: "build",
minify: !dev,
clean: !dev,
outExtension: () => {
return { js: ".user.js", dts: ".user.dts" }
},
esbuildPlugins: [
userscript({
metadata,
proxy: dev
? {
port: 8080,
metadata,
targets: () => true,
}
: undefined,
}),
],
})