Skip to content

Commit 9c56400

Browse files
authored
Add support for .cjs and .mjs next config (#25)
1 parent fc3d5d3 commit 9c56400

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/build.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ export async function build() {
3131
}
3232

3333
function checkRunningInsideNextjsApp() {
34-
if (!fs.existsSync(path.join(appPath, "next.config.js"))) {
34+
const extension = ["js", "cjs", "mjs"].find((ext) =>
35+
fs.existsSync(path.join(appPath, `next.config.${ext}`))
36+
);
37+
if (!extension) {
3538
console.error("Error: next.config.js not found. Please make sure you are running this command inside a Next.js app.");
3639
process.exit(1);
3740
}
@@ -63,6 +66,9 @@ function setStandaloneBuildMode() {
6366
}
6467

6568
function buildNextjsApp(monorepoRoot: string) {
69+
// note: always pass in "next.config.js" as the entrypoint.
70+
// @vercel/next only accepts "next.config.js" as the
71+
// entrypoint. But it doesn't actually use the file.
6672
return nextBuild({
6773
files: [],
6874
repoRootPath: monorepoRoot,

0 commit comments

Comments
 (0)