Robert Jaros
01/16/2024, 1:36 PMwasmJs
compose-runtime based application (not compose-web). I don't want nor need skiko and I have disabled unpacking it with compose {}
dsl in gradle. But when adding compose.animation
dependency I can't build my project with this error:
Module not found: Error: Can't resolve './skiko.mjs'
It works ok when I allow generation of skiko.wasm, but I don't want to load almost 9MB of unused code. The same project builds fine when targeting js
(compose animations work fine without skiko).Oleksandr Karpovich [JB]
01/16/2024, 2:05 PMRobert Jaros
01/16/2024, 2:55 PMwebpack.NormalModuleReplacementPlugin
to replace skiko.mjs with some fake, empty module. It allowed me to build my app for both dev and prod, but the development version crashes with a runtime error import object field 'org_jetbrains_skia_Bitmap__1nMake' is not a Function
. What's interesting, the production version (processed with binaryen) works fine.Robert Jaros
01/16/2024, 2:56 PMOleksandr Karpovich [JB]
01/16/2024, 2:57 PMRobert Jaros
01/16/2024, 6:19 PMZac Sweers
04/12/2024, 5:42 PMRobert Jaros
04/12/2024, 7:34 PMimplementation(npm("aaa-kilua-assets", "0.0.7"))
Robert Jaros
04/12/2024, 7:35 PMskiko.js
file to webpack.config.d
directory with this content:
;(function(config) {
const webpack = require('webpack');
config.plugins.push(new webpack.NormalModuleReplacementPlugin(
/^\.\/skiko.mjs$/,
function(resource) { resource.request = "aaa-kilua-assets/index.js" }
));
})(config);
Robert Jaros
04/12/2024, 7:36 PMCan't resolve './skiko.mjs'
errorKazik Pogoda
08/18/2025, 1:53 PM// src/jsMain/resources/skiko-stub.js
export const skikoApi = {
_createLocalCallbackScope: function() {
// Empty implementation
},
_releaseLocalCallbackScope: function() {
// Empty implementation
},
_registerCallback: function(cb, data, global) {
// Return default value
return 0;
}
};
And webpack.config.d/skiko.js
:
;(function(config) {
const webpack = require('webpack');
const path = require('path');
config.plugins.push(new webpack.NormalModuleReplacementPlugin(
/^\.\/skiko.mjs$/,
function(resource) {
// Point to your own stub file instead
resource.request = path.resolve(__dirname, 'kotlin/skiko-stub.js');
}
));
})(config);
I have no intention of using skiko at all, but it seems that it is being pulled for compose HTML as a transitive dependency of:
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.koin.compose.viewmodel)
implementation(libs.androidx.navigation.componse)
It would work anyway, if not for the fact that the general js
flavour for skiko
refers to external JS files provided only with jsWasm
. Thx a lot for all the hints!