Skip to content

Commit

Permalink
Expand missing next.config error message (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankboosi authored Oct 10, 2024
1 parent c63b16a commit 66ba0ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .changeset/swift-geckos-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@opennextjs/cloudflare": patch
---

enhancement: Expand missing next.config error message

Found out that next dev can run the a Next.js app without next.config but
if we are using the adapter we throw an error if we don't find the config.
So expanded the error for users.
5 changes: 4 additions & 1 deletion packages/cloudflare/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ console.log(`Building the Next.js app in the current folder (${nextAppDir})`);

if (!["js", "cjs", "mjs", "ts"].some((ext) => existsSync(`./next.config.${ext}`))) {
// TODO: we can add more validation later
throw new Error("Error: Not in a Next.js app project");
console.error(
"Error: next.config file not found. Please make sure you run the command inside a Next.js app"
);
process.exit(1);
}

const { skipBuild, outputDir } = getArgs();
Expand Down

0 comments on commit 66ba0ff

Please sign in to comment.