Skip to content

Commit 9e9d71b

Browse files
authored
fix: 🐛 #74 process reference (#75)
1 parent 0630adf commit 9e9d71b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/util.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,15 @@ export function getNodeHeight(node: HTMLElement) {
111111
export function getPixelRatio() {
112112
let ratio
113113

114-
const val = process && process.env ? process.env.devicePixelRatio : null
114+
let FINAL_PROCESS
115+
try {
116+
FINAL_PROCESS = process
117+
} catch (e) {}
118+
119+
const val =
120+
FINAL_PROCESS && FINAL_PROCESS.env
121+
? FINAL_PROCESS.env.devicePixelRatio
122+
: null
115123
if (val) {
116124
ratio = parseInt(val, 10)
117125
if (isNaN(ratio)) {

0 commit comments

Comments
 (0)