Skip to content

Commit 71bde87

Browse files
Uzlopakyunyinplainheart
authored
fix(env): fix env detection compatibility for node, bun, and deno
* fix(env): fix env detection compatibility for node, bun, and deno * bugfix running without navigator.userAgent --------- Co-authored-by: yunyin <[email protected]> Co-authored-by: plainheart <[email protected]>
1 parent 7d9f873 commit 71bde87

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/env.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ else if (typeof document === 'undefined' && typeof self !== 'undefined') {
3838
env.worker = true;
3939
}
4040
else if (
41-
typeof navigator === 'undefined'
42-
|| navigator.userAgent.indexOf('Node.js') === 0
41+
(typeof process !== 'undefined' && typeof process.version === 'string')
42+
|| (typeof navigator === 'undefined' || typeof navigator.userAgent === 'undefined')
43+
|| (env.hasGlobalWindow && 'Deno' in window)
4344
) {
4445
// In node
4546
env.node = true;

0 commit comments

Comments
 (0)