From 0448e3d2e243685287d1d52a9b45838f1a6d3eda Mon Sep 17 00:00:00 2001 From: Bohdan Yavorskyi Date: Thu, 21 Dec 2023 14:05:42 +0200 Subject: [PATCH] chore: update client side check to use window --- index.js | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 292e4ee..426fe00 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -function e(e){return e&&e.default||e}module.exports=global.DOMPurify=global.DOMPurify||("undefined"==typeof process?e(require("dompurify")):function(){const r=e(require("dompurify")),{JSDOM:u}=e(require("jsdom")),{window:o}=new u("");return r(o)}()); \ No newline at end of file +function e(e){return e&&e.default||e}module.exports=global.DOMPurify=global.DOMPurify||("undefined"!=typeof window?e(require("dompurify")):function(){const r=e(require("dompurify")),{JSDOM:u}=e(require("jsdom")),{window:o}=new u("");return r(o)}()); \ No newline at end of file diff --git a/src/index.js b/src/index.js index 3cd35d4..4ea465d 100644 --- a/src/index.js +++ b/src/index.js @@ -10,7 +10,7 @@ function initDOMPurifyWithJSDOM() { } function resolveDOMPurify() { - const isClientSide = typeof process === 'undefined'; + const isClientSide = typeof window !== 'undefined'; return isClientSide ? importModule(require('dompurify')) : initDOMPurifyWithJSDOM(); }