Skip to content

Commit b8b38ee

Browse files
authored
Clean output directory before build to prevent recursive bundling (#857)
1 parent ce5c7b4 commit b8b38ee

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/six-days-watch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
Clean output directory before `next build`

packages/cloudflare/src/cli/build/build.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ export async function build(
4747
logger.info(`@opennextjs/cloudflare version: ${cloudflare}`);
4848
logger.info(`@opennextjs/aws version: ${aws}`);
4949

50+
// Clean the output directory before building the Next app.
51+
buildHelper.initOutputDir(options);
52+
5053
if (projectOpts.skipNextBuild) {
5154
logger.warn("Skipping Next.js build");
5255
} else {
@@ -58,7 +61,6 @@ export async function build(
5861

5962
// Generate deployable bundle
6063
printHeader("Generating bundle");
61-
buildHelper.initOutputDir(options);
6264

6365
compileCache(options);
6466
compileEnvFiles(options);

0 commit comments

Comments
 (0)