Skip to content

Commit a6e0210

Browse files
authored
feat(debug): never minify in debug mode (#629)
1 parent 009332b commit a6e0210

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/open-next/src/build/bundleNextServer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ const externals = [
4242
"next/dist/compiled/next-server",
4343
];
4444

45-
export async function bundleNextServer(outputDir: string, appPath: string) {
45+
export async function bundleNextServer(
46+
outputDir: string,
47+
appPath: string,
48+
{ debug = false },
49+
) {
4650
const require = createRequire(`${appPath}/package.json`);
4751
const entrypoint = require.resolve("next/dist/esm/server/next-server.js");
4852

@@ -54,7 +58,7 @@ export async function bundleNextServer(outputDir: string, appPath: string) {
5458
// packages: "external",
5559
format: "cjs",
5660
external: externals,
57-
minify: true,
61+
minify: !debug,
5862
outfile: path.join(outputDir, "next-server.runtime.prod.js"),
5963
sourcemap: false,
6064
plugins: [

packages/open-next/src/build/createServerBundle.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ async function generateBundle(
134134
// Bundle next server if necessary
135135
const isBundled = fnOptions.experimentalBundledNextServer ?? false;
136136
if (isBundled) {
137-
await bundleNextServer(path.join(outputPath, packagePath), appPath);
137+
await bundleNextServer(path.join(outputPath, packagePath), appPath, {
138+
debug: options.debug,
139+
});
138140
}
139141

140142
// Copy middleware

packages/open-next/src/build/edge/createEdgeBundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ globalThis.AsyncLocalStorage = AsyncLocalStorage;
148148
outfile,
149149
allowOverwrite: true,
150150
bundle: true,
151-
minify: true,
151+
minify: !options.debug,
152152
platform: "node",
153153
format: "esm",
154154
conditions: ["workerd", "worker", "browser"],

0 commit comments

Comments
 (0)