Skip to content

Commit 67a08fa

Browse files
committed
fix: conditionally change working directory
1 parent 0121255 commit 67a08fa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/templates/getHandler.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ type Mutable<T> = {
2727
// We return a function and then call `toString()` on it to serialise it as the launcher function
2828
// eslint-disable-next-line max-params
2929
const makeHandler = (conf: NextConfig, app, pageRoot, staticManifest: Array<[string, string]> = [], mode = 'ssr') => {
30-
// Change working directory into the site root
30+
// Change working directory into the site root, unless using Nx, which moves the
31+
// dist directory and handles this itself
3132
const dir = path.resolve(__dirname, app)
32-
33-
process.chdir(dir)
33+
if (pageRoot.startsWith(dir)) {
34+
process.chdir(dir)
35+
}
3436

3537
// This is just so nft knows about the page entrypoints. It's not actually used
3638
try {

0 commit comments

Comments
 (0)