cats-effect
cats-effect copied to clipboard
Use `js.typeOf` checks for JS feature tests instead of try/catch
trafficstars
This is my fault. I've been lazily using Try(js.Dynamic.global....) when I should be writing idiomatic code like this:
https://github.com/typelevel/cats-effect/blob/76d2602ea651a6f0035bef4f9aa506773a335c95/std/js/src/main/scala/cats/effect/std/JavaSecureRandom.scala#L77-L78
Today in the Discord there were reports of ReferenceError: Can't find variable: process. So time to fix this.
So I forgot, there was a reason for this besides my laziness.
- Said webpack plugin is essentially doing a text replacement of
process.env.CATS_EFFECT_TRACING_MODEwith the desired value. Note that definingprocess.env.CATS_EFFECT_TRACING_MODEin webpack will not defineprocessnorprocess.env.
https://github.com/typelevel/cats-effect/pull/2207#issuecomment-899543589
The problem is that some env-setting bundler tooling expects it to be written in full form, so laddered undefined checks will not work 😕