File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 877877
878878 :handled )))
879879
880+ (defmacro ^:private elide-require
881+ " Experimental. The presence of `js/require` calls can cause issues with
882+ React Native, even if they never execute. Currently no other known
883+ workarounds. Ref. https://github.com/ptaoussanis/sente/issues/247."
884+ [& body]
885+ (when-not (enc/get-sys-val " SENTE_ELIDE_JS_REQUIRE" )
886+ `(do ~@body)))
887+
880888#?(:cljs
881889 (def ^:private ?node-npm-websocket_
882890 " nnil iff the websocket npm library[1] is available.
887895 [1] Ref. https://www.npmjs.com/package/websocket
888896 [2] Ref. https://github.com/RyanMcG/lein-npm"
889897 (delay ; Eager eval causes issues with React Native, Ref. #247,
890- (when (and node-target? (exists? js/require))
891- (try
892- (js/require " websocket" )
893- ; ; In particular, catch 'UnableToResolveError'
894- (catch :default e
895- ; ; (errorf e "Unable to load npm websocket lib")
896- nil ))))))
898+ (elide-require
899+ (when (and node-target? (exists? js/require))
900+ (try
901+ (js/require " websocket" )
902+ ; ; In particular, catch 'UnableToResolveError'
903+ (catch :default e
904+ ; ; (errorf e "Unable to load npm websocket lib")
905+ nil )))))))
897906
898907#?(:cljs
899908 (defrecord ChWebSocket
You can’t perform that action at this time.
0 commit comments