Skip to content

Commit 4d1da8e

Browse files
committed
fix: copying excess files to output directory
1 parent 297e147 commit 4d1da8e

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.changeset/sixty-years-cheat.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
fix: copying excess files to output directory
6+
7+
In previous version, we copied the entire `.next` directory to the `.worker-next` output directory. Going forward, it will only copy the `.next/standalone` directory to this location.

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ export async function build(projectOpts: ProjectOptions): Promise<void> {
2727
// Clean the output directory
2828
await cleanDirectory(projectOpts.outputDir);
2929

30-
// Copy the .next directory to the output directory so it can be mutated.
31-
cpSync(join(projectOpts.sourceDir, ".next"), join(projectOpts.outputDir, ".next"), { recursive: true });
30+
// Copy the .next/standalone directory to the output directory so it can be mutated.
31+
cpSync(
32+
join(projectOpts.sourceDir, ".next", "standalone"),
33+
join(projectOpts.outputDir, ".next", "standalone"),
34+
{ recursive: true }
35+
);
3236

3337
const config = getConfig(projectOpts);
3438

packages/cloudflare/src/cli/config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export type Config = {
2727
root: string;
2828
// Path to the OpenNext static assets directory
2929
assets: string;
30-
// Path to the app's `.next` directory in the OpenNext output directory
31-
dotNext: string;
3230
// Path to the application standalone root directory
3331
standaloneRoot: string;
3432
// Path to the application standalone directory (where `next build` saves the standalone app)
@@ -92,7 +90,6 @@ export function getConfig(projectOpts: ProjectOptions): Config {
9290
output: {
9391
root: projectOpts.outputDir,
9492
assets: join(projectOpts.outputDir, "assets"),
95-
dotNext,
9693
standaloneRoot,
9794
standaloneApp,
9895
standaloneAppDotNext,

0 commit comments

Comments
 (0)