Skip to content
Open
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
14 changes: 14 additions & 0 deletions .changeset/bundler-runtime-build-output-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@opennextjs/aws": patch
---

Fix `getBundlerRuntime` ignoring `buildOutputPath`

`getBundlerRuntime` looked for the Next.js server output under `appPath`, which
is always the project root and does not follow the `buildOutputPath` config.
Every other consumer of the Next.js build output (`getBuildId`,
`copyEnvFile`, `createServerBundle`, …) resolves it from `appBuildOutputPath`.

As a result, setting `buildOutputPath` to anything other than `.` failed the
build with `Unable to determine Next.js runtime (webpack or turbopack)` as soon
as the project root no longer contained a stale `.next` directory.
5 changes: 4 additions & 1 deletion packages/open-next/src/build/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,10 @@ export function getPackagePath(options: BuildOptions) {
export function getBundlerRuntime(
options: BuildOptions,
): "webpack" | "turbopack" {
const dotNextServerPath = path.join(options.appPath, ".next/server");
const dotNextServerPath = path.join(
options.appBuildOutputPath,
".next/server",
);
if (fs.existsSync(path.join(dotNextServerPath, "webpack-runtime.js"))) {
return "webpack";
}
Expand Down