Skip to content

Commit 921aca4

Browse files
authored
load amaro correctly (#137)
Signed-off-by: Matteo Collina <hello@matteocollina.com>
1 parent 9d53e3e commit 921aca4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/start.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { parseArgs, promisify } from 'util'
66
import { request } from 'undici'
77
import { exec } from 'child_process'
88

9-
const __dirname = import.meta.dirname
10-
119
const execAsync = promisify(exec)
1210

1311
const msOneMinute = 1000 * 60
@@ -50,12 +48,17 @@ export async function start (client, selectedRuntime) {
5048
}
5149
}
5250

53-
const configFile = join(__dirname, '..', 'watt.json')
54-
const server = await create(configFile, undefined, {
51+
// We move to the project root to start the server
52+
// so amaro will load correctly
53+
const cwd = process.cwd()
54+
const root = join(import.meta.dirname, '..')
55+
process.chdir(root)
56+
const server = await create('watt.json', undefined, {
5557
setupSignals: false,
5658
isProduction: true
5759
})
5860
entrypointUrl = await server.start()
61+
process.chdir(cwd)
5962

6063
if (record) {
6164
async function shutdown () {

0 commit comments

Comments
 (0)