Skip to content

Commit aaf4e71

Browse files
rwlanupfwang
andauthored
fixes import path for server function's real handler in monorepo with nested folders (#61)
* fixes import path for server function's real handler in monorepo with nested folders * Fix server function handler import path building on Windows --------- Co-authored-by: Frank <[email protected]>
1 parent fce3edf commit aaf4e71

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/bright-buses-reflect.md

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 server function handler import path building on Windows

packages/open-next/src/build.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,11 @@ function createServerBundle(monorepoRoot: string) {
188188
// the root of the bundle. We will create a dummy `index.mjs`
189189
// that re-exports the real handler.
190190
if (isMonorepo) {
191+
// always use posix path for import path
192+
const packagePosixPath = packagePath.split(path.sep).join(path.posix.sep);
191193
fs.writeFileSync(
192194
path.join(outputPath, "index.mjs"),
193-
[`export * from "./${packagePath}/index.mjs";`].join("")
195+
[`export * from "./${packagePosixPath}/index.mjs";`].join("")
194196
);
195197
}
196198

0 commit comments

Comments
 (0)