Anyone else seeing the following get printed multi...
# webassembly
e
Anyone else seeing the following get printed multiple times when anything happens with webpack in Kotlin 2.0
Critical dependency: Accessing import.meta directly is unsupported (only property access or destructuring is supported)
✔️ 2
r
Yes. Since the latest rc.
👍 2
e
Maybe it's because of this change? Probably it complains because of
const importMeta = import.meta;
https://github.com/jetbrains/kotlin/commit/9df561a5c284aeba6a16ca00a8699511de5cfb04
r
e
Thanks. I'm not sure I fully understand what originates the problem tbh, that is why
import.meta
is required. If that code is the "loading" code, isn't it better to output a different version based on the compilation target, instead of checking if it's Node or browser at runtime?
r
The code generated by the kotlin/wasm compiler contains several different loading methods, which are used in different environments (e.g. browser, node, deno etc.). I reported the original issue - the paths in the bundle were absolute paths to the local filesystem.
Currently there are no absolute paths in the bundle but the code still doesn't work in node. I use the workaround with a complex regexp in my gradle plugin.
e
Ahh damn, so it's a blocker for Node.js?
r
It's hard to say, because Kotlin gradle plugin doesn't support webpack for NodeJS.
I use my own custom task to generate webpack bundle.
There are no problems e.g. when running tests with node.
So it's a problem with a use case, which is unsupported anyway 🙂
✔️ 1
e
There is an issue to add Webpack for Node tho. So solving it might be useful anyway.
a
@Ilya Goncharov [JB] ^^