@@ -8,6 +8,7 @@ import { ContentUpdater } from "@opennextjs/aws/plugins/content-updater.js";
8
8
import { build , type Plugin } from "esbuild" ;
9
9
10
10
import { getOpenNextConfig } from "../../api/config.js" ;
11
+ import type { ProjectOptions } from "../project-options.js" ;
11
12
import { patchVercelOgLibrary } from "./patches/ast/patch-vercel-og-library.js" ;
12
13
import { patchWebpackRuntime } from "./patches/ast/webpack-runtime.js" ;
13
14
import { inlineDynamicRequires } from "./patches/plugins/dynamic-requires.js" ;
@@ -44,7 +45,7 @@ const optionalDependencies = [
44
45
/**
45
46
* Bundle the Open Next server.
46
47
*/
47
- export async function bundleServer ( buildOpts : BuildOptions ) : Promise < void > {
48
+ export async function bundleServer ( buildOpts : BuildOptions , projectOpts : ProjectOptions ) : Promise < void > {
48
49
copyPackageCliFiles ( packageDistDir , buildOpts ) ;
49
50
50
51
const { appPath, outputDir, monorepoRoot, debug } = buildOpts ;
@@ -76,9 +77,9 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
76
77
format : "esm" ,
77
78
target : "esnext" ,
78
79
// Minify code as much as possible but stay safe by not renaming identifiers
79
- minifyWhitespace : ! debug ,
80
+ minifyWhitespace : projectOpts . minify && ! debug ,
80
81
minifyIdentifiers : false ,
81
- minifySyntax : ! debug ,
82
+ minifySyntax : projectOpts . minify && ! debug ,
82
83
legalComments : "none" ,
83
84
metafile : true ,
84
85
// Next traces files using the default conditions from `nft` (`node`, `require`, `import` and `default`)
0 commit comments