fxos-components/bridge

Lib minimized with "--compilation_level=ADVANCED_OPTIMIZATIONS" doesn't work

Closed this issue · 2 comments

I've tried to compile lib with:

ccjs bridge.js --language_in=ECMASCRIPT6 \
               --language_out=ES5 \
               --compilation_level=ADVANCED_OPTIMIZATIONS \
               > bridge.min.js

And I see errors like Error: Unable to establish a connection with "undefined". Either the target endpoint is not alive or the Service is not .listen()ing..

While everything works ok with:

ccjs bridge.js --language_in=ECMASCRIPT6 \
               --language_out=ES5 \
               --compilation_level=SIMPLE_OPTIMIZATIONS \
               > bridge.min.js

As the test app I've used https://github.com/nga-crash-tests/bridge-local-broadcast-channel hosted locally.

Found out CC was mangling the options.service property when using the options object.

Not sure why it wasn't mangling the other two. Perhaps to do with all the funkyness going on in constructor, maybe we should simplify that to limit code paths.