Webpack loader for Kotlin
yarn add --dev @wasm-tool/kotlin-loader
We expect kotlin-native
to be in your $PATH
. To install check here
Add the loader and plugin in your webpack.config.js
here:
module.exports = {
// ...
module: {
rules: [
{
test: /Main.kt$/,
loader: "@wasm-tool/kotlin-loader"
}
]
},
// ...
plugins: [
new HtmlWebpackPlugin({
template: 'index.html'
}),
]
// ...
};
Add this script to the index.html
template
<script wasm="program.wasm" src="program.wasm.js"></script>