How can I get the env variables in KMP Wasm? I tri...
# webassembly
y
How can I get the env variables in KMP Wasm? I tried below code but it failed...
Copy code
// commonMain
expect val SERVER_DOMAIN: String


// wasmJsMain
actual val SERVER_DOMAIN: String
    get() {
        return js("process.env[KTOR_HOST]")
    }
Build Fail:
'js(code)' should be a single expression inside a top-level function body or a property initializer in Kotlin/Wasm.
t
Just create private function with
js
call inside and call it in getter