Fix runtime loading
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good
This commit is contained in:
parent
32f9ef3bba
commit
82bcc72d21
@ -30,7 +30,7 @@ let scrollRuntime: IRuntime | null = null;
|
||||
|
||||
export function log(s: unknown, level: LogLevel = LogLevel.Notice): void {
|
||||
getRuntime().then(({ file }) => {
|
||||
const raw = typeof s === 'string' ? s : JSON.stringify(s, null, 2);
|
||||
const raw = JSON.stringify(s, null, 2);
|
||||
const output = `${level}: ${raw}\n`;
|
||||
|
||||
const outputFile = (level === LogLevel.Error)
|
||||
@ -85,13 +85,16 @@ export async function getRuntime(): Promise<IRuntime> {
|
||||
const pkg = await import(path);
|
||||
if ('default' in pkg) {
|
||||
scrollRuntime = pkg.default;
|
||||
}
|
||||
|
||||
if (scrollRuntime !== null) {
|
||||
return Promise.resolve(scrollRuntime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.reject('Missing default import');
|
||||
}
|
||||
|
||||
return Promise.resolve(scrollRuntime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user