https://kotlinlang.org logo
g

galex

06/23/2018, 1:53 PM
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) ?
i

ilya.gorbunov

06/23/2018, 2:04 PM
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
g

galex

06/23/2018, 2:10 PM
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
4 Views