Skip to content

Commit

Permalink
use a literal path to import the config (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb authored Nov 6, 2024
1 parent c5aa622 commit 8055c18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/open-next/src/core/createGenericHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export async function createGenericHandler<
E extends BaseEventOrResult = InternalEvent,
R extends BaseEventOrResult = InternalResult,
>(handler: GenericHandler<Type, E, R>) {
//First we load the config
// @ts-expect-error
// @ts-expect-error `./open-next.config.mjs` exists only in the build output
const config: OpenNextConfig = await import("./open-next.config.mjs").then(
(m) => m.default,
);
Expand Down
8 changes: 4 additions & 4 deletions packages/open-next/src/core/createMainHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ declare global {
}

export async function createMainHandler() {
//First we load the config
const config: OpenNextConfig = await import(
process.cwd() + "/open-next.config.mjs"
).then((m) => m.default);
// @ts-expect-error `./open-next.config.mjs` exists only in the build output
const config: OpenNextConfig = await import("./open-next.config.mjs").then(
(m) => m.default,
);

const thisFunction = globalThis.fnName
? config.functions![globalThis.fnName]
Expand Down

0 comments on commit 8055c18

Please sign in to comment.