I'm encountering an error while setting up SQLDel...
# squarelibraries
y
I'm encountering an error while setting up SQLDelight for WebAssembly in a Kotlin Multiplatform project targeting WebAssembly. When initializing the database worker, I get the following console error:
Copy code
composeApp.uninstantiated.mjs:189 WebWorkerException:
  {
    "message":"Uncaught SyntaxError: Unexpected token '<'",
    "type":"error"
  } isTrusted,true
  kotlinx.coroutines.error_$external_fun @ composeApp.uninstantiated.mjs:189
Is this primarily a SQLDelight configuration issue or a coroutines uncaught exception? Relevant Code Snippets: Database Configuration:
Copy code
private val workerScriptUrl: String = 
      js("""new URL("@cashapp/sqldelight-sqljs-worker/sqljs.worker.js", import.meta.url)""")
  
  actual val platformModule = module {
      single {
          val driver = WebWorkerDriver(Worker(workerScriptUrl)).apply {
              enableForeignKeys()
          }
          LlmsDatabaseWrapper(driver, LlmsDatabase(driver))
      }
  }
Webpack Configuration (sqljs.js)
Copy code
config.resolve = {
      fallback: {
          fs: false,
          path: false,
          crypto: false,
      }
  };
  
  const CopyWebpackPlugin = require('copy-webpack-plugin');
  config.plugins.push(
      new CopyWebpackPlugin({
          patterns: [
              '../../node_modules/sql.js/dist/sql-wasm.wasm'
          ]
      })
  );
for more context. check out this repository link: https://github.com/yassineAbou/LLMS