Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions .changeset/three-oranges-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@opennextjs/aws": minor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we usually treat internal API changes as patch changes.

I'm fine with either but maybe @conico974 has a stronger opinion?

---

fix: support absolute paths for OpenNext config compilation utility

Compiling OpenNext configs will now support the ability to pass in either absolute or relative paths, instead of treating any input as a relative path.
4 changes: 2 additions & 2 deletions packages/open-next/src/build.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from "node:path";
import url from "node:url";

import {
Expand Down Expand Up @@ -32,8 +33,7 @@ export async function build(
const openNextDistDir = url.fileURLToPath(new URL(".", import.meta.url));

const { config, buildDir } = await compileOpenNextConfig(
baseDir,
openNextConfigPath,
path.join(baseDir, openNextConfigPath ?? "open-next.config.ts"),
{ nodeExternals },
);

Expand Down
11 changes: 2 additions & 9 deletions packages/open-next/src/build/compileConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,15 @@ import { validateConfig } from "./validateConfig.js";
*
* The configuration is always compiled for Node.js and for the edge only if needed.
*
* @param baseDir Directory where to look for the configuration.
* @param openNextConfigPath Override the default configuration when provided. Relative to baseDir.
* @param sourcePath Path to the configuration file.
* @param nodeExternals Coma separated list of Externals for the Node.js compilation.
* @param compileEdge Force compiling for the edge runtime when true
* @return The configuration and the build directory.
*/
export async function compileOpenNextConfig(
baseDir: string,
openNextConfigPath?: string,
sourcePath: string,
{ nodeExternals = "", compileEdge = false } = {},
) {
const sourcePath = path.join(
baseDir,
openNextConfigPath ?? "open-next.config.ts",
);

const buildDir = fs.mkdtempSync(path.join(os.tmpdir(), "open-next-tmp"));
let configPath = compileOpenNextConfigNode(
sourcePath,
Expand Down
Loading