Is it possible that `JsKlibEsModuleExportsChecker`...
# javascript
e
Is it possible that
JsKlibEsModuleExportsChecker
is currently mistakenly being used even when compiling to CJS?
b
At the phase when we're compiling Kotlin to a KLIB (the phase where this checker is run) the compiler doesn't know the target module system: nothing is preventing you to take that KLIB and compile it to JS with any module system. That's why the compiler takes the conservative approach and reports ESM-specific diagnostics even if the actual target module system is not ESM.
e
Makes sense! Is there a way the message can be made clearer that it's being run in a phase too early to know the module system? Not saying it's wrong, but a typical user would think "what a sec, am I using ES modules?".
b
True, it may be a bit misleading. I'll create a ticket to improve wording.
gratitude thank you 1