Robert Jaros
09/05/2025, 9:13 AMwasmJs
target insted of js
. The changes are really simple and wasm target works perfectly fine. I would be happy to contribute, but the problem is how to implement both js and wasmJs at the same time, considering that we can have only js, only wasmJs or both targets enabled in the same project. Do you have any suggestions how would you like this to work?CLOVIS
09/05/2025, 9:33 AMCLOVIS
09/05/2025, 9:34 AMCLOVIS
09/05/2025, 9:36 AMkotlin {
js("worker")
js("app")
wasmJs("wasmApp")
}
vite {
enableFor(kotlin.js("app"), kotlin.wasmJs("wasmApp"))
}
which would create the tasks :viteRunApp
, :viteRunWasmApp
, :viteBuildApp
, :viteBuildWasmApp
, etcCLOVIS
09/05/2025, 9:36 AMRobert Jaros
09/05/2025, 9:44 AMjs
target and no manual configuration?Robert Jaros
09/05/2025, 10:01 AMuninstantiated.mjs
file, generated by the Kotlin compiler contains different conditional for runtims (NodeJS, deno) and it uses node APIs like fs
and url
. Vite complains:
[plugin vite:resolve] Module "fs" has been externalized for browser compatibility, imported by "/home/rjaros/git/kilua-dev/build/vite/prod/kotlin/kilua-dev.uninstantiated.mjs". See <https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility> for more details.
Also there is a problem with `await`:
assets/index-!~{001}~.js:14222:17: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)
file: assets/index-!~{001}~.js:14222:17
Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)
14220| }
14221|
14222| const exports = (await instantiate({
Robert Jaros
09/05/2025, 10:03 AMRobert Jaros
09/05/2025, 4:37 PMmodules
? There is no such target for Vite.Robert Jaros
09/05/2025, 4:55 PMRobert Jaros
09/05/2025, 5:07 PMRobert Jaros
09/05/2025, 5:21 PMRobert Jaros
09/05/2025, 5:25 PM