Skip to content

Commit 66ba0ff

Browse files
Expand missing next.config error message (#85)
1 parent c63b16a commit 66ba0ff

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.changeset/swift-geckos-turn.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
enhancement: Expand missing next.config error message
6+
7+
Found out that next dev can run the a Next.js app without next.config but
8+
if we are using the adapter we throw an error if we don't find the config.
9+
So expanded the error for users.

packages/cloudflare/src/cli/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ console.log(`Building the Next.js app in the current folder (${nextAppDir})`);
1010

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

1619
const { skipBuild, outputDir } = getArgs();

0 commit comments

Comments
 (0)