diff --git a/examples/basic-js/app/[locale]/head.jsx b/examples/basic-js/app/[locale]/head.jsx
deleted file mode 100644
index 5ad797f..0000000
--- a/examples/basic-js/app/[locale]/head.jsx
+++ /dev/null
@@ -1,10 +0,0 @@
-export default function Head() {
- return (
- <>
-
Create Next App
-
-
-
- >
- )
-}
diff --git a/examples/basic-js/public/favicon.ico b/examples/basic-js/app/favicon.ico
similarity index 100%
rename from examples/basic-js/public/favicon.ico
rename to examples/basic-js/app/favicon.ico
diff --git a/examples/basic/app/favicon.ico b/examples/basic/app/favicon.ico
new file mode 100644
index 0000000..718d6fe
Binary files /dev/null and b/examples/basic/app/favicon.ico differ
diff --git a/packages/codegen/src/build/collect-public.ts b/packages/codegen/src/build/collect-public.ts
index e9ad98a..dc2d1ad 100644
--- a/packages/codegen/src/build/collect-public.ts
+++ b/packages/codegen/src/build/collect-public.ts
@@ -1,12 +1,21 @@
import _glob from "glob";
import { promisify } from "util";
const glob = promisify(_glob);
+import fse from "fs-extra";
+const { stat } = fse;
/**
* @returns A string array of all the files in the public folder
*/
const collectPublicFiles = async () => {
- return (await glob("public/**/*")).map((path) => path.slice(6));
+ const publicFiles = (await glob("public/**/*")).map((path) => path.slice(6));
+ try {
+ if ((await stat("app/favicon.ico")).isFile())
+ publicFiles.push("/favicon.ico");
+ } catch {
+ /* empty */
+ }
+ return publicFiles;
};
export default collectPublicFiles;
diff --git a/packages/codegen/src/dev.ts b/packages/codegen/src/dev.ts
index e65e499..acce042 100644
--- a/packages/codegen/src/dev.ts
+++ b/packages/codegen/src/dev.ts
@@ -28,6 +28,7 @@ const watchConfig = {
"app/**/route.{ts,js}",
"app/**/redirect.{ts,js}",
"public/**/*",
+ "app/favicon.ico",
],
"add unlink change": [
"app/**/forward.dynamic.{ts,js}",
diff --git a/packages/runtime/src/router/ejected/head/index.ts b/packages/runtime/src/router/ejected/head/index.ts
index 87a33ce..77f0c10 100644
--- a/packages/runtime/src/router/ejected/head/index.ts
+++ b/packages/runtime/src/router/ejected/head/index.ts
@@ -10,7 +10,7 @@ ${renderHooksImport(hooks)}
${renderDynamicImports(imports)}
-const publicFiles = new Set([${publicFiles
+const publicFiles = new Set([${Array.from(new Set(publicFiles))
.map((publicFile) => `"${publicFile}"`)
.join(", ")}]);
`.trim();