I checked out the latest plovr and added closure to my project using bower. while compiling the code with closure-compiler.jar in advanced_compilation works without any error or warning, using plovr gives the following errors:
/closure/goog/ui/buttonrenderer.js:107: WARNING - goog.ui.ButtonRenderer.base is never defined
var element = goog.ui.ButtonRenderer.base(this, 'createDom', button);
^
/closure/goog/ui/menu.js:425: WARNING - goog.ui.Menu.base is never defined
var handled = goog.ui.Menu.base(this, 'handleKeyEventInternal', e);
^
/closure/goog/ui/menu.js:447: WARNING - goog.ui.Menu.base is never defined
goog.ui.Menu.base(this, 'setHighlightedIndex', index);
^
/closure/goog/ui/select.js:61: WARNING - goog.ui.Select.base is never defined
goog.ui.Select.base(this, 'constructor',
^
/closure/goog/ui/select.js:142: WARNING - goog.ui.Select.base is never defined
goog.ui.Select.base(this, 'handleMenuAction', e);
^
I have set closure library in config.js using
"closure-library": "bower_components/closure-library/closure/goog/",
is there a way to solve this?
This is a mismatch that is bound to happen when an updated Library is used along with a stale Compiler release (Plovr is known to get behind compiler releases). These particular warnings are about .base
not being supported by the Compiler release bundled with Plovr. .base
was introduced as an alternative to goog.base
and the superClass_
property to comply with ES5 strict when expressing inheritance (no poking arguments.callee
).
Here are a few options:
Use the closure-library bundled with Plovr
Grab Plovr's source; replace closure-compiler and build with ant build
(I have personally not tried this recently)
The Medium team maintain their own Plovr fork, which is more in line with recent Closure Compiler releases. Since you're in a node environment, you can try with NPM: npm install plovr --save-dev
(I use this fork personally with an updated vanilla Library checkout)