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/seven-bats-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/cloudflare": patch
---

fix: --noMinify stop minifying the bundle
2 changes: 1 addition & 1 deletion packages/cloudflare/src/cli/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function build(

await compileDurableObjects(options);

await bundleServer(options);
await bundleServer(options, projectOpts);

if (!projectOpts.skipWranglerConfigCheck) {
await createWranglerConfigIfNotExistent(projectOpts);
Expand Down
7 changes: 4 additions & 3 deletions packages/cloudflare/src/cli/build/bundle-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ContentUpdater } from "@opennextjs/aws/plugins/content-updater.js";
import { build, type Plugin } from "esbuild";

import { getOpenNextConfig } from "../../api/config.js";
import type { ProjectOptions } from "../project-options.js";
import { patchVercelOgLibrary } from "./patches/ast/patch-vercel-og-library.js";
import { patchWebpackRuntime } from "./patches/ast/webpack-runtime.js";
import { inlineDynamicRequires } from "./patches/plugins/dynamic-requires.js";
Expand Down Expand Up @@ -44,7 +45,7 @@ const optionalDependencies = [
/**
* Bundle the Open Next server.
*/
export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
export async function bundleServer(buildOpts: BuildOptions, projectOpts: ProjectOptions): Promise<void> {
copyPackageCliFiles(packageDistDir, buildOpts);

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