Skip to content

Commit c4dc319

Browse files
authored
Merge pull request #253 from olafbuitelaar/env_fix_v4.8.5
fix nodejs environment usage in browser environments for v4.8.5
2 parents 773fd33 + 13bfb80 commit c4dc319

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class Logger<LogObj> extends BaseLogger<LogObj> {
1717
// style only for blink browsers
1818
settings.stylePrettyLogs = settings.stylePrettyLogs && isBrowser && !isBrowserBlinkEngine ? false : settings.stylePrettyLogs;
1919

20-
super(NodeRuntime, settings, logObj, isSafari ? 4 : 5);
20+
super(isBrowser && typeof(process) === 'undefined' ? BrowserRuntime : NodeRuntime, settings, logObj, isSafari ? 4 : 5);
2121
}
2222

2323
/**

src/runtime/nodejs/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export interface IMeta extends IMetaStatic {
3434

3535
const meta: IMetaStatic = {
3636
runtime: "Nodejs",
37-
runtimeVersion: process.version,
38-
hostname: hostname(),
37+
runtimeVersion: (typeof process !== 'undefined') ? process.version : null,
38+
hostname: hostname ? hostname() : null,
3939
};
4040

4141
export function getMeta(

0 commit comments

Comments
 (0)