Sadly I get the same error with `@JsNonModule`
# javascript
m
Sadly I get the same error with
@JsNonModule
r
Could you please show how do you import module
dexie
? I mean the line where
$module$dexie
is defined.
m
Copy code
(function (_, Kotlin, $module$dexie) {
  // ..
}(module.exports, require('kotlin'), require('dexie')));
And in Kotlin, I've just got some code in the same package as the ts2kt bindings that just invokes:
Copy code
val database = Dexie("foo")
r
Could you try build you code as either UMD or plain module? I think the problem is about you use commonjs in browser which is basically for nodejs
m
Possibly, I'll confess I'm a bit out of my depth here, as I don't really understand the JS module landscape! For a bit more context, in our use case we're building a library in Kotlin JS for consumption by a vanilla ES6 application built using Create React App. The CRA app pulls in our Kotlin JS lib in its package.json via a
file:/
dependency -- which otherwise works ... just the references to Dexie as a third-party dependency are proving troublesome. Is there a better way we might go about this?
r
It’s OK 🙂 This page provides good information about module system. https://kotlinlang.org/docs/reference/js-modules.html.