How to solve ‘missing %output%’ error when using Closure Compiler.

Alexey Komov
Reflecting on bits
Published in
1 min readApr 28, 2016
TLDR; Use --output_wrapper_file option.

If you’re, like me, using closurebuilder.py to launch Closure Compiler compilation using output_wrapper option, you might be encountering this error:

ERROR — invalid output_wrapper specified. Missing ‘%output%’.

Though the output wrapper in my case had %output% included and was the following:

//UMD bundling closure code inside.
;(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory();
} else {
root.MomentumScroller = factory();
}
}(this, function () {
%output%
return MomentumScroller;
}));

What did the trick here was putting output wrapper in a separate file, say, output-wrapper.js and using it with output-wrapper-file option.

Hope it helps. Cheers!

I’m Alexey Komov — front-end developer and web enthusiast, interested in core and definitive Web things. Please share your thoughts about article. And you may contact me here.

--

--