kotlin-frontend-plugin
kotlin-frontend-plugin copied to clipboard
backend-frontend code sharing
Hi, I would like to know if there is any documentation about using this plugin for a full stack application with code that is shared between the server and client? (essentially models, validation logic, utility functions, etc.)
BTW If there is so - I would like to suggest updating the full-stack-example to include such sharing.
Afaik there is no documentation at the moment. But only few steps are needed.
- Create Multiplatform project https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-a-multiplatform-project
- Implement your platform specific / inter-platform code
- Add this multiplatform project as dependency to your project with the Kotlin frontend plugin defined (on the previous multiplatform layout your dependency must point to the js part project)
Now you should be able to use the JS part of your multiplatform project within the frontend project.
when I do this, everything works fine until I add "webpackConfigFile = "webpack.config.js" to my webpack bundle. Once I do that it fails to recognize my package structure... com.foo, foo is unrecognized