Skip to content
Merged
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
2 changes: 1 addition & 1 deletion packages/open-next/src/build/createAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function createCacheAssets(options: buildHelper.BuildOptions) {

const { appBuildOutputPath, outputDir } = options;
const packagePath = buildHelper.getPackagePath(options);
const buildId = buildHelper.getBuildId(appBuildOutputPath);
const buildId = buildHelper.getBuildId(options);
let useTagCache = false;

// Copy pages to cache folder
Expand Down
4 changes: 1 addition & 3 deletions packages/open-next/src/build/generateOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,7 @@ export async function generateOutput(options: BuildOptions) {
const patterns = "patterns" in value ? value.patterns : ["*"];
patterns.forEach((pattern) => {
behaviors.push({
pattern: prefixer(
pattern.replace(/BUILD_ID/, getBuildId(appBuildOutputPath)),
),
pattern: prefixer(pattern.replace(/BUILD_ID/, getBuildId(options))),
origin: value.placement === "global" ? undefined : key,
edgeFunction:
value.placement === "global"
Expand Down
7 changes: 5 additions & 2 deletions packages/open-next/src/build/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,12 @@ export function getHtmlPages(dotNextPath: string) {
.reduce((acc, page) => acc.add(page), new Set<string>());
}

export function getBuildId(dotNextPath: string) {
export function getBuildId(options: BuildOptions) {
return fs
.readFileSync(path.join(dotNextPath, ".next/BUILD_ID"), "utf-8")
.readFileSync(
path.join(options.appBuildOutputPath, ".next/BUILD_ID"),
"utf-8",
)
.trim();
}

Expand Down
Loading