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
4 changes: 2 additions & 2 deletions packages/open-next/src/build/bundleNextServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const externals = [
export async function bundleNextServer(
outputDir: string,
appPath: string,
{ debug = false },
{ minify = true },
) {
const require = createRequire(`${appPath}/package.json`);
const entrypoint = require.resolve("next/dist/esm/server/next-server.js");
Expand All @@ -58,7 +58,7 @@ export async function bundleNextServer(
// packages: "external",
format: "cjs",
external: externals,
minify: !debug,
minify,
outfile: path.join(outputDir, "next-server.runtime.prod.js"),
sourcemap: false,
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion packages/open-next/src/build/createServerBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async function generateBundle(
const isBundled = fnOptions.experimentalBundledNextServer ?? false;
if (isBundled) {
await bundleNextServer(path.join(outputPath, packagePath), appPath, {
debug: options.debug,
minify: options.minify,
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/open-next/src/build/edge/createEdgeBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ globalThis.AsyncLocalStorage = AsyncLocalStorage;
outfile,
allowOverwrite: true,
bundle: true,
minify: !options.debug,
minify: options.minify,
platform: "node",
format: "esm",
conditions: ["workerd", "worker", "browser"],
Expand Down
14 changes: 9 additions & 5 deletions packages/open-next/src/build/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ export function normalizeOptions(
appPackageJsonPath = findNextPackageJsonPath(appPath, monorepoRoot);
}

const debug = Boolean(process.env.OPEN_NEXT_DEBUG) ?? false;

return {
appBuildOutputPath: buildOutputPath,
appPackageJsonPath,
appPath,
appPublicPath: path.join(appPath, "public"),
buildDir: path.join(outputDir, ".build"),
config,
debug: Boolean(process.env.OPEN_NEXT_DEBUG) ?? false,
debug,
// Whether ESBuild should minify the code
minify: !debug,
monorepoRoot,
nextVersion: getNextVersion(appPath),
openNextVersion: getOpenNextVersion(),
Expand Down Expand Up @@ -98,13 +102,13 @@ export function esbuildSync(
esbuildOptions: ESBuildOptions,
options: BuildOptions,
) {
const { openNextVersion, debug } = options;
const { openNextVersion, debug, minify } = options;
const result = buildSync({
target: "esnext",
format: "esm",
platform: "node",
bundle: true,
minify: !debug,
minify,
mainFields: ["module", "main"],
sourcemap: debug ? "inline" : false,
sourcesContent: false,
Expand Down Expand Up @@ -134,13 +138,13 @@ export async function esbuildAsync(
esbuildOptions: ESBuildOptions,
options: BuildOptions,
) {
const { openNextVersion, debug } = options;
const { openNextVersion, debug, minify } = options;
const result = await buildAsync({
target: "esnext",
format: "esm",
platform: "node",
bundle: true,
minify: !debug,
minify,
mainFields: ["module", "main"],
sourcemap: debug ? "inline" : false,
sourcesContent: false,
Expand Down