Add SSR bundle minify config

This commit is contained in:
2026-10-17 15:03:30 +01:00
parent 8a981c854a
commit ed788dff97
10 changed files with 108 additions and 8 deletions
+17
View File
@@ -0,0 +1,17 @@
type Params = {
/**
* The value of `minify_ssr_bundle` in `bunext.config.ts`
* (`global.BUNEXT_CONFIG.minify_ssr_bundle`).
*/
minify_ssr_bundle?: boolean;
};
/**
* Whether the SSR bundle should be minified.
*
* The SSR output is read off local disk by the server and is never downloaded
* by a browser, so minifying it only costs build memory. Dev is never minified.
* In production the bundle is minified unless `minify_ssr_bundle` is explicitly
* set to `false` in `bunext.config.ts`.
*/
export default function shouldMinifySSR(params?: Params): boolean;
export {};
+14
View File
@@ -0,0 +1,14 @@
import isDevelopment from "./is-development";
/**
* Whether the SSR bundle should be minified.
*
* The SSR output is read off local disk by the server and is never downloaded
* by a browser, so minifying it only costs build memory. Dev is never minified.
* In production the bundle is minified unless `minify_ssr_bundle` is explicitly
* set to `false` in `bunext.config.ts`.
*/
export default function shouldMinifySSR(params = {}) {
if (isDevelopment())
return false;
return params.minify_ssr_bundle !== false;
}