diff --git a/examples/create-next-app/public/next.svg b/examples/create-next-app/public/next.svg
new file mode 100644
index 00000000..5174b28c
--- /dev/null
+++ b/examples/create-next-app/public/next.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/create-next-app/public/vercel.svg b/examples/create-next-app/public/vercel.svg
new file mode 100644
index 00000000..d2f84222
--- /dev/null
+++ b/examples/create-next-app/public/vercel.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/create-next-app/src/app/page.tsx b/examples/create-next-app/src/app/page.tsx
index 1179ed2a..25977bc4 100644
--- a/examples/create-next-app/src/app/page.tsx
+++ b/examples/create-next-app/src/app/page.tsx
@@ -2,94 +2,110 @@ import Image from "next/image";
export default function Home() {
return (
-
-
-
-
- -
- Get started by editing{" "}
-
- src/app/page.tsx
-
- .
-
- - Save and see your changes instantly.
-
-
-
+
+
+
+ Get started by editing
+ src/app/page.tsx
+
+
-
-
+
+
+
+
+
+
+
+
);
}
diff --git a/packages/cloudflare/src/build/build-worker.ts b/packages/cloudflare/src/build/build-worker.ts
index 94165d41..349482a2 100644
--- a/packages/cloudflare/src/build/build-worker.ts
+++ b/packages/cloudflare/src/build/build-worker.ts
@@ -1,6 +1,6 @@
import { NextjsAppPaths } from "../nextjs-paths";
import { build, Plugin } from "esbuild";
-import { readFileSync } from "node:fs";
+import { existsSync, readFileSync } from "node:fs";
import { cp, readFile, writeFile } from "node:fs/promises";
import { patchRequire } from "./patches/investigated/patch-require";
@@ -20,6 +20,7 @@ import { updateWebpackChunksFile } from "./patches/investigated/update-webpack-c
* @param nextjsAppPaths
*/
export async function buildWorker(
+ inputNextAppDir: string,
outputDir: string,
nextjsAppPaths: NextjsAppPaths,
templateSrcDir: string
@@ -124,10 +125,19 @@ Request = globalThis.Request;
await updateWorkerBundledCode(workerOutputFile, nextjsAppPaths);
console.log(`\x1b[35m⚙️ Copying asset files...\n\x1b[0m`);
+
+ // Copy over client-side generated files
await cp(`${nextjsAppPaths.dotNextDir}/static`, `${outputDir}/assets/_next/static`, {
recursive: true,
});
+ // Copy over any static files (e.g. images) from the source project
+ if (existsSync(`${inputNextAppDir}/public`)) {
+ await cp(`${inputNextAppDir}/public`, `${outputDir}/assets`, {
+ recursive: true,
+ });
+ }
+
console.log(`\x1b[35mWorker saved in \`${workerOutputFile}\` 🚀\n\x1b[0m`);
}
diff --git a/packages/cloudflare/src/build/build.ts b/packages/cloudflare/src/build/build.ts
index e4bbec39..add90c5d 100644
--- a/packages/cloudflare/src/build/build.ts
+++ b/packages/cloudflare/src/build/build.ts
@@ -43,7 +43,7 @@ export async function build(inputNextAppDir: string, opts: BuildOptions): Promis
const templateDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "templates");
- await buildWorker(outputDir, nextjsAppPaths, templateDir);
+ await buildWorker(inputNextAppDir, outputDir, nextjsAppPaths, templateDir);
}
type BuildOptions = {