Trying to use Goggle's closure compiler on a K/JS ...
# javascript
h
Trying to use Goggle's closure compiler on a K/JS module using ADVANCED_OPTIMIZATIONS, I keep getting complaints about 'module' (and 'variable' and 'require'):
wrapper.js:6: ERROR - [JSC_UNDEFINED_VARIABLE] variable module is undeclared
. Is there an easy fix for this that I missed?
a
You might be looking for the
--process_common_js_modules
flag, which tells the closure compiler there are predefined module system declarations (couldn't find official docs for that; https://www.evanlouie.com/posts/google-closure-compiler-quickstart seems legit enough)
h
Brilliant! Super-thanks! (I now get
Failed to load module "kotlin"
instead, but this is progress!)
a
"kotlin"
is the standard library. Make sure you include it in your build.
h
Oh, I do! My library is already in use and in production, so this is a bit surprising. The problem only arises when I enable ADVANCED_OPTIMIZATIONS, so my fix for now is to wait with this.