Skip to content

Commit

Permalink
build: improve chunk names
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 4, 2024
1 parent ca2282b commit 4106750
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineBuildConfig } from "unbuild";
import { resolve } from "pathe";
import { fileURLToPath } from "node:url";
import { normalize } from "pathe";

const srcDir = fileURLToPath(new URL("src", import.meta.url));

Expand Down Expand Up @@ -56,4 +57,15 @@ export default defineBuildConfig({
"firebase-functions",
"@scalar/api-reference",
],
rollup: {
output: {
chunkFileNames(chunk) {
const id = normalize(chunk.moduleIds.at(-1));
if (id.includes("/src/cli/")) {
return "cli/[name].mjs";
}
return "_chunks/[name].mjs";
},
},
},
});

0 comments on commit 4106750

Please sign in to comment.