Skip to content

Commit

Permalink
fix: copy favicon.ico from app dir (#301)
Browse files Browse the repository at this point in the history
* fix: copy favicon from app dir
  • Loading branch information
annleefores authored Nov 2, 2023
1 parent fe5684e commit 438560b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/open-next/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ function createImageOptimizationBundle() {
function createStaticAssets() {
console.info(`Bundling static assets...`);

const { appBuildOutputPath, appPublicPath, outputDir } = options;
const { appBuildOutputPath, appPublicPath, outputDir, appPath } = options;

// Create output folder
const outputPath = path.join(outputDir, "assets");
Expand All @@ -377,6 +377,7 @@ function createStaticAssets() {
// - .next/BUILD_ID => _next/BUILD_ID
// - .next/static => _next/static
// - public/* => *
// - app/favicon.ico or src/app/favicon.ico => favicon.ico
fs.copyFileSync(
path.join(appBuildOutputPath, ".next/BUILD_ID"),
path.join(outputPath, "BUILD_ID"),
Expand All @@ -389,6 +390,16 @@ function createStaticAssets() {
if (fs.existsSync(appPublicPath)) {
fs.cpSync(appPublicPath, outputPath, { recursive: true });
}

const appSrcPath = fs.existsSync(path.join(appPath, "src"))
? "src/app"
: "app";

const faviconPath = path.join(appPath, appSrcPath, "favicon.ico");

if (fs.existsSync(faviconPath)) {
fs.copyFileSync(faviconPath, path.join(outputPath, "favicon.ico"));
}
}

function createCacheAssets(monorepoRoot: string, disableDynamoDBCache = false) {
Expand Down

1 comment on commit 438560b

@vercel
Copy link

@vercel vercel bot commented on 438560b Nov 2, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

open-next – ./

open-next-git-main-sst-dev.vercel.app
open-next-sst-dev.vercel.app
open-next.vercel.app

Please sign in to comment.