Browse Source

ts: Fix browser detection (#1233)

Aximili 3 năm trước cách đây
mục cha
commit
8ddc9f25a6
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 1 1
      ts/rollup.config.ts
  2. 1 1
      ts/src/utils/common.ts

+ 1 - 1
ts/rollup.config.ts

@@ -27,7 +27,7 @@ export default {
       preventAssignment: true,
       values: {
         "process.env.NODE_ENV": JSON.stringify(env),
-        "process.env.BROWSER": JSON.stringify(true),
+        "process.env.ANCHOR_BROWSER": JSON.stringify(true),
       },
     }),
     terser(),

+ 1 - 1
ts/src/utils/common.ts

@@ -3,7 +3,7 @@
  * false if in a Node process or electron app.
  */
 export const isBrowser =
-  process.env.BROWSER ||
+  process.env.ANCHOR_BROWSER ||
   (typeof window !== "undefined" && !window.process?.hasOwnProperty("type"));
 
 /**