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 @@ -61,7 +61,7 @@ export function createCacheAssets(options: buildHelper.BuildOptions) {
logger.info("Bundling cache assets...");

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

Expand Down
14 changes: 5 additions & 9 deletions packages/open-next/src/build/createServerBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@ export async function createServerBundle(options: buildHelper.BuildOptions) {

const remainingRoutes = new Set<string>();

const { appBuildOutputPath, monorepoRoot } = options;

const packagePath = path.relative(monorepoRoot, appBuildOutputPath);
const { appBuildOutputPath } = options;

// Find remaining routes
const serverPath = path.join(
appBuildOutputPath,
".next",
"standalone",
packagePath,
".next",
"server",
".next/standalone",
buildHelper.getPackagePath(options),
".next/server",
);

// Find app dir routes
Expand Down Expand Up @@ -118,7 +114,7 @@ async function generateBundle(
// `node_modules` inside `.next/standalone`, and others inside
// `.next/standalone/package/path` (ie. `.next`, `server.js`).
// We need to output the handler file inside the package path.
const packagePath = path.relative(monorepoRoot, appBuildOutputPath);
const packagePath = buildHelper.getPackagePath(options);
fs.mkdirSync(path.join(outputPath, packagePath), { recursive: true });

const ext = fnOptions.runtime === "deno" ? "mjs" : "cjs";
Expand Down
4 changes: 4 additions & 0 deletions packages/open-next/src/build/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,7 @@ export async function isEdgeRuntime(
}
return (await overrides?.wrapper?.())?.edgeRuntime;
}

export function getPackagePath(options: BuildOptions) {
return path.relative(options.monorepoRoot, options.appBuildOutputPath);
}
Loading