I currently deploy our KMP project in a Node.js en...
# javascript
e
I currently deploy our KMP project in a Node.js environment. The next step is deploying to the browser. The project implements TCP clients, so on Node.js I'll have a
JsNodeSocket
implementation, and on the browser I'll have a
JsWebSocket
implementation (before you ask, no I can't use WebSockets outside of browser). The correct implementation to instantiate is established at runtime.
JsNodeSocket
internally uses kotlin-wrappers Node.js externals. I suppose that in this state compiling once and haveing the project run on both Node.js and the browser is impossible. The outputted JS will try to
require('node:net')
at the very beginning, failing if inside of a browser. What can I do to avoid this? Not use externals?