Skip to content

Commit e10053e

Browse files
authored
Merge 8542308 into 3675e35
2 parents 3675e35 + 8542308 commit e10053e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

demos/default/pages/api/hello.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
22

33
export default (req, res) => {
4-
res.status(200).json({ name: 'John Doe', query: req.query, env: process.env.HELLO_WORLD })
4+
res.status(200).json({ name: 'John Doe', query: req.query, env: process.env.HELLO_WORLD, cwd: process.cwd() })
55
}

src/templates/getHandler.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ 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
31+
const dir = path.resolve(__dirname, app)
32+
33+
process.chdir(dir)
34+
3035
// This is just so nft knows about the page entrypoints. It's not actually used
3136
try {
3237
// eslint-disable-next-line node/no-missing-require
@@ -65,7 +70,7 @@ const makeHandler = (conf: NextConfig, app, pageRoot, staticManifest: Array<[str
6570
const NextServer: NextServerType = getNextServer()
6671
const nextServer = new NextServer({
6772
conf,
68-
dir: path.resolve(__dirname, app),
73+
dir,
6974
customServer: false,
7075
hostname: url.hostname,
7176
port,

0 commit comments

Comments
 (0)