Environment Detection does not work with JS ES Modules
When this module is used as a dependency in a project that uses the setting "compilerOptions { target = "es2015" }", suddenly environment variables aren't available to the application via MultiplatformSystem.readEnvironmentVariable.
It looks like when the JS code tries to determine the environment, it uses a raw 'require'. I believe this is causing an error when inside of an mjs context, causing the system to assume its running in a browser context, even though it is not.
Discovered this after switching a project based on Clikt to use ESM.
So the import code is actually rather complicated in order to support different environments and avoid compiler warnings: https://github.com/ajalt/mordant/blob/master/mordant/src/jsMain/kotlin/com/github/ajalt/mordant/internal/JsCompat.kt
Do you have any suggestions on how to support that module type?
I think the async style require might work? though I'm not sure how well that would fit into you existing code. I'll think on it.