Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand missing next.config error message #85

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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