Skip to content

Commit 3b31ba5

Browse files
committed
perf: minify the generated bundle by default
1 parent 5f197fc commit 3b31ba5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/cloudflare/src/cli/build/bundle-server.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const optionalDependencies = [
4848
export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
4949
patches.copyPackageCliFiles(packageDistDir, buildOpts);
5050

51-
const { appPath, outputDir, monorepoRoot } = buildOpts;
51+
const { appPath, outputDir, monorepoRoot, debug } = buildOpts;
5252
const baseManifestPath = path.join(
5353
outputDir,
5454
"server-functions/default",
@@ -76,7 +76,11 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
7676
outfile: openNextServerBundle,
7777
format: "esm",
7878
target: "esnext",
79-
minify: false,
79+
// Minify code as much as possible but stay safe by not renaming identifiers
80+
minifyWhitespace: !debug,
81+
minifyIdentifiers: false,
82+
minifySyntax: !debug,
83+
legalComments: "none",
8084
metafile: true,
8185
// Next traces files using the default conditions from `nft` (`node`, `require`, `import` and `default`)
8286
//

0 commit comments

Comments
 (0)