galex

    galex

    4 years ago
    It seems to me that kotlin2js doesn’t convert to Javascript code that is not from its own module, correct? In that case how do we import code from a module (common-js) which implements the shared code between platforms (module common) ?
    ilya.gorbunov

    ilya.gorbunov

    4 years ago
    If you have multiple modules built with Kotlin/JS, each gets compiled to its own .js file.
    In the end you may need to gather them all, one way do that is to write gradle task, see http://kotlinlang.org/docs/tutorials/javascript/getting-started-gradle/getting-started-with-gradle.html for details
    galex

    galex

    4 years ago
    Wow thank you so much I’m trying that immediately!
    So then I don’t use the bundle.js file but import each module.js in my web page?
    The main error I get is the following: Module not found: Error: Can’t resolve ‘common-js’ in ‘/Users/galex/multi/backup-chord-view-mpp-before-android/chord-view-js/build/classes/kotlin/main’ @ ./chord-view-js.js 3:4-55 @ multi webpack-dev-server/client?http://localhost:8088/ webpack/hot/dev-server ./chord-view-jsℹ️ 「wdm」: Failed to compile.
    If you got an example of a working project with common - then under - common-js, common_android, common-ios and projects that uses those platforms modules I would really appreciate that