Skip to content

Commit 6395849

Browse files
authored
Fix "Cannot find package 'next'" (#77)
1 parent d81ddcc commit 6395849

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"open-next": patch
3+
---
4+
5+
Fix "Cannot find package 'next'"

packages/open-next/src/build.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ export async function build() {
1313
// Pre-build validation
1414
printVersion();
1515
checkRunningInsideNextjsApp();
16-
setStandaloneBuildMode();
1716
const { root: monorepoRoot, packager } = findMonorepoRoot();
1817

1918
// Build Next.js app
2019
printHeader("Building Next.js app");
20+
setStandaloneBuildMode(monorepoRoot);
2121
await buildNextjsApp(packager);
2222

2323
// Generate deployable bundle
@@ -64,9 +64,11 @@ function findMonorepoRoot() {
6464
return { root: appPath, packager: "npm" as const };
6565
}
6666

67-
function setStandaloneBuildMode() {
68-
// Equivalent to setting `target: 'standalone'` in next.config.js
67+
function setStandaloneBuildMode(monorepoRoot: string) {
68+
// Equivalent to setting `target: "standalone"` in next.config.js
6969
process.env.NEXT_PRIVATE_STANDALONE = "true";
70+
// Equivalent to setting `experimental.outputFileTracingRoot` in next.config.js
71+
process.env.NEXT_PRIVATE_OUTPUT_TRACE_ROOT = monorepoRoot;
7072
}
7173

7274
function buildNextjsApp(packager: "npm" | "yarn" | "pnpm") {

0 commit comments

Comments
 (0)