Ahmed Elzeiny

04/05/2023, 6:59 PM
Hello everyone, I have a Kotlin Multiplatform Mobile (KMM) library that I want to use in my Next.js server-side rendering frontend project. I have created the APIs and everything is working fine. I have published the library as an npm package, and it is working fine on the client-side. However, when I try to use it on the server-side, I am getting an error message that says “Error: Cannot find module ‘abort-controller’.” I have already added the following dependencies to my project:
runtimeOnly(npm("abort-controller", "3.0.0")) 
runtimeOnly(npm("node-fetch", "2.6.1"))
I have verified that these dependencies exist and are installed, but I am still getting the same error. Here are my versions:
private const val ktorVersion = "2.2.3"
I am using Kotlin version 1.8.0. any insights or workarounds to fix it ?