Skip to content
Closed
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
7 changes: 7 additions & 0 deletions .changeset/sixty-years-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@opennextjs/cloudflare": patch
---

fix: copying excess files to output directory

In previous versions, 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In previous versions, 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.
In previous versions, we copied the entire `.next` directory to the `.worker-next` output directory. Since this is not necessary, going forward, we will only copy the `.next/standalone` directory to this location.

8 changes: 6 additions & 2 deletions packages/cloudflare/src/cli/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ export async function build(projectOpts: ProjectOptions): Promise<void> {
// Clean the output directory
await cleanDirectory(projectOpts.outputDir);

// Copy the .next directory to the output directory so it can be mutated.
cpSync(join(projectOpts.sourceDir, ".next"), join(projectOpts.outputDir, ".next"), { recursive: true });
// Copy the .next/standalone directory to the output directory so it can be mutated.
cpSync(
join(projectOpts.sourceDir, ".next", "standalone"),
join(projectOpts.outputDir, ".next", "standalone"),
{ recursive: true }
);

const config = getConfig(projectOpts);

Expand Down
3 changes: 0 additions & 3 deletions packages/cloudflare/src/cli/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export type Config = {
root: string;
// Path to the OpenNext static assets directory
assets: string;
// Path to the app's `.next` directory in the OpenNext output directory
dotNext: string;
// Path to the application standalone root directory
standaloneRoot: string;
// Path to the application standalone directory (where `next build` saves the standalone app)
Expand Down Expand Up @@ -92,7 +90,6 @@ export function getConfig(projectOpts: ProjectOptions): Config {
output: {
root: projectOpts.outputDir,
assets: join(projectOpts.outputDir, "assets"),
dotNext,
standaloneRoot,
standaloneApp,
standaloneAppDotNext,
Expand Down