forked from h3js/srvx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.config.mjs
More file actions
50 lines (49 loc) · 1.17 KB
/
build.config.mjs
File metadata and controls
50 lines (49 loc) · 1.17 KB
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
import { defineBuildConfig } from "obuild/config";
import { rm } from "node:fs/promises";
import { join } from "node:path";
import pkg from "./package.json" with { type: "json" };
export default defineBuildConfig({
entries: [
{
type: "bundle",
input: [
"src/types.ts",
"src/cli.ts",
"src/static.ts",
"src/log.ts",
"src/cookie.ts",
...[
"deno",
"bun",
"node",
"cloudflare",
"generic",
"service-worker",
].map((adapter) => `src/adapters/${adapter}.ts`),
],
rolldown: {
define: {
"globalThis.__srvx_version__": JSON.stringify(pkg.version),
},
plugins: [
pkg.name === "srvx-nightly" && {
name: "nightly-alias",
resolveId(id) {
if (id.startsWith("srvx")) {
return {
id: id.replace("srvx", "srvx-nightly"),
external: true,
};
}
},
},
],
},
},
],
hooks: {
async end(ctx) {
await rm(join(ctx.pkgDir, "dist/types.mjs"));
},
},
});