Hello, why does my production optimized JS bundle ...
# javascript
r
Hello, why does my production optimized JS bundle file contain strings with my source file names and line numbers? Screenshot in thread.
Zrzut ekranu z 2025-04-26 13-33-12.png
c
most probably the message for the
Intrinsics
check
Copy code
@Metadata(
   mv = {1, 8, 0},
   k = 2,
   xi = 48,
   d1 = {"\u0000\u0010\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\u001a\u0016\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0003¨\u0006\u0005"},
   d2 = {"checkParameter", "", "parameter", "", "expected", "Sources of xor-library.compiler-plugin.xor-gradle-plugin.main"}
)
public final class TestKt {
   public static final void checkParameter(@NotNull String parameter, @NotNull String expected) {
      Intrinsics.checkNotNullParameter(parameter, "parameter");
      Intrinsics.checkNotNullParameter(expected, "expected");
      if (!Intrinsics.areEqual(parameter, expected)) {
         throw new IllegalArgumentException("Parameter " + parameter + " is not equal to " + expected);
      }
   }
}
r
The same strings are in the development build, and it seems to me like something related to compose runtime.
Zrzut ekranu z 2025-04-26 14-02-20.png
👍🏼 1
l
It may be because of the
includeSourceInformation
flag, which was enabled by default in Kotlin 2.1.20
r
It is very likely indeed. But why is this option a good idea on JS platform? 🤔
l
It's not, at least for production. But there's no way to configure different default compose options per target, see KT-69900.
r
I think this is fixing Android target but definitely breaking things on JS platform at the same time. It increases bundle size and leaks potentially confidential information to public builds.
👍 1
j
You will need https://youtrack.jetbrains.com/issue/KT-75442/ to fully eliminate them
The compose compiler is compiled with them enabled, and as a result every remember inlines them. You can turn them off for your compilation units, but you'll still waste tons of space on them.
On Android R8 strips all of these automatically
r
reminds me of an issue I created in 2023, if this was not fixed yet, then you will not only see file names but also file paths: https://youtrack.jetbrains.com/issue/KT-64220/KJS-IR-Stacktrace-should-not-contain-project-path-when-the-library-was-built