Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .changeset/nine-impalas-wave.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

feat: cli arg to disable minification

The cache handler currently forces minification. There is now a CLI arg to disable minification for the build. At the moment, this only applies to the cache handler but may be used for other parts of the build in the future when minification is introduced to them.
The cache handler currently forces minification. There is now a CLI arg to disable minification for the build. At the moment, this only applies to the cache handler but may be used for other parts of the build in the future when minification is introduced to them. By default, minification is enabled, but can be disabled by passing `--noMinify`.
4 changes: 2 additions & 2 deletions packages/cloudflare/src/cli/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { resolve } from "node:path";
export function getArgs(): {
skipBuild: boolean;
outputDir?: string;
noMinify?: boolean;
minify?: boolean;
} {
const {
values: { skipBuild, output, noMinify },
Expand Down Expand Up @@ -36,7 +36,7 @@ export function getArgs(): {
return {
outputDir,
skipBuild: skipBuild || ["1", "true", "yes"].includes(String(process.env.SKIP_NEXT_APP_BUILD)),
noMinify,
minify: !noMinify,
};
}

Expand Down
6 changes: 3 additions & 3 deletions packages/cloudflare/src/cli/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function getConfig(projectOpts: ProjectOptions): Config {
build: {
timestamp: Date.now(),
skipNextBuild: !!projectOpts.skipBuild,
shouldMinify: !projectOpts.noMinify,
shouldMinify: !!projectOpts.minify,
},

paths: {
Expand Down Expand Up @@ -104,8 +104,8 @@ export type ProjectOptions = {
outputDir: string;
// Whether the Next.js build should be skipped (i.e. if the `.next` dir is already built)
skipBuild?: boolean;
// Whether minification of the worker should be disabled
noMinify?: boolean;
// Whether minification of the worker should be enabled
minify?: boolean;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/cloudflare/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ if (!["js", "cjs", "mjs", "ts"].some((ext) => existsSync(`./next.config.${ext}`)
process.exit(1);
}

const { skipBuild, outputDir, noMinify } = getArgs();
const { skipBuild, outputDir, minify } = getArgs();

await build({
sourceDir: nextAppDir,
outputDir: resolve(outputDir ?? nextAppDir, ".worker-next"),
skipBuild,
noMinify,
minify,
});