Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/giant-books-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/cloudflare": patch
---

perf: minify the generated bundle by default
8 changes: 6 additions & 2 deletions packages/cloudflare/src/cli/build/bundle-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const optionalDependencies = [
export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
patches.copyPackageCliFiles(packageDistDir, buildOpts);

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