Fiouz
01/25/2023, 5:34 PMconst val FOOBAR: String = "xxx/xxx"
and in various parts of the codebase:
someVar = js("require('$FOOBAR/foo/bar.html')") // for processing by webpack-html-loader
after upgrading from Kotlin 1.7 to 1.8.0 and enabling the new IR backend, the JS output would sometime become:
<GENERATED>.someVar = require('xxx/xxx/foo/bar.html') // OK, this is the expected output
but sometimes* it generates the following wrong output
<GENERATED>.someVar = require('/foo/bar.html') // WRONG! seems like the compiler does see the value of $FOOBAR
I have been trying to produce a short self-contained correct example (it's part of a bigger private project), but so far no luck in reproducing the issue
is there a way for me to debug the compiler to see what happens?
_sometimes*_: the affected Kotlin statements are consistent between compilations, but not all statements having that shape are affectedFiouz
01/25/2023, 5:39 PMturansky
01/25/2023, 7:16 PMjs
call at all. 😞
You can write custom external require
to avoid such problemsFiouz
01/26/2023, 8:26 AM