Pass require() as an externs def to the JS compiler. Bug: Issue 10653 Change-Id: I2bb56a8069e7a9f6f8b323f7cae62de948db9a44
diff --git a/BUILD b/BUILD index f84f778..4733856 100644 --- a/BUILD +++ b/BUILD
@@ -3,6 +3,7 @@ polygerrit_plugin( name = "image-diff", srcs = glob(["**/*.html", "**/*.js"]), + externs = ["externs.js"], app = "plugin.html", deps = ["//lib/js:resemblejs"], -) \ No newline at end of file +)
diff --git a/externs.js b/externs.js new file mode 100644 index 0000000..2d41eb5 --- /dev/null +++ b/externs.js
@@ -0,0 +1,14 @@ +/** + * @fileoverview Defines externally defined symbols that the JS Closure compiler + * must be aware of: 1. Don't complain about "is undeclared". 2. Don't rename. + * + * @externs + */ + +/** + * resemblejs uses the nodejs require fuction without declaring it + * + * @param {string} id + * @return {*} + */ +function require(id) {}