Skip to content

Commit dfc174d

Browse files
authored
feat(middleware): add ability to force single build pass (#613)
1 parent a43b82b commit dfc174d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/yellow-phones-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/aws": patch
3+
---
4+
5+
feat(middleware): add ability to force single build pass

packages/open-next/src/build/createMiddleware.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ import { installDependencies } from "./installDeps.js";
1414
* Compiles the middleware bundle.
1515
*
1616
* @param options Build Options.
17+
* @param forceOnlyBuildOnce force to build only once.
1718
*/
18-
export async function createMiddleware(options: buildHelper.BuildOptions) {
19+
export async function createMiddleware(
20+
options: buildHelper.BuildOptions,
21+
{ forceOnlyBuildOnce = false } = {},
22+
) {
1923
logger.info(`Bundling middleware function...`);
2024

2125
const { appBuildOutputPath, config, outputDir } = options;
@@ -57,6 +61,7 @@ export async function createMiddleware(options: buildHelper.BuildOptions) {
5761
defaultConverter: "aws-cloudfront",
5862
includeCache: config.dangerous?.enableCacheInterception,
5963
additionalExternals: config.edgeExternals,
64+
onlyBuildOnce: forceOnlyBuildOnce === true,
6065
});
6166

6267
installDependencies(outputPath, config.middleware?.install);

0 commit comments

Comments
 (0)