Skip to content

Commit

Permalink
Add support for .cjs and .mjs next config (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang authored Jan 6, 2023
1 parent fc3d5d3 commit 9c56400
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export async function build() {
}

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

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

0 comments on commit 9c56400

Please sign in to comment.