-
Notifications
You must be signed in to change notification settings - Fork 459
/
build.config.ts
43 lines (41 loc) · 1.11 KB
/
build.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
import { defineBuildConfig } from "unbuild";
import { resolve, normalize } from "pathe";
import { fileURLToPath } from "node:url";
const srcDir = fileURLToPath(new URL("src", import.meta.url));
export default defineBuildConfig({
declaration: true,
name: "nitro",
entries: [
"src/index",
"src/config",
"src/cli/index",
{ input: "src/presets/", outDir: "dist/presets", format: "esm" },
{ input: "src/runtime/", outDir: "dist/runtime", format: "esm" },
],
alias: {
nitropack: resolve(srcDir, "index.ts"),
"nitropack/": srcDir,
"nitropack/presets": resolve(srcDir, "presets/index.ts"),
"nitropack/presets/": resolve(srcDir, "presets"),
},
rollup: {
output: {
chunkFileNames(chunk) {
const id = normalize(chunk.moduleIds.at(-1));
if (id.includes("/src/cli/")) {
return "cli/[name].mjs";
}
if (id.endsWith("/nitro.ts")) {
return "nitro.mjs";
}
return "chunks/[name].mjs";
},
},
},
externals: [
"nitropack",
"nitropack/presets",
"firebase-functions",
"@scalar/api-reference",
],
});