Tests failing with latest Closure Compiler snapshot
Description
Environment
Activity
Mike Fikes July 4, 2018 at 12:05 PM
Fixed with upstream Closure Compiler patch https://github.com/google/closure-compiler/commit/79eac91661edabd48220ff54e24a0684f6120128
Mike Fikes July 2, 2018 at 12:23 PM
Confirmed that this PR causes the ClojureScript compiler unit tests to pass https://github.com/google/closure-compiler/pull/3000
Mike Fikes July 1, 2018 at 11:48 PM
Closure Compiler issue submitted: https://github.com/google/closure-compiler/issues/2999
Mike Fikes July 1, 2018 at 11:17 PM
Perhaps this is a regression in Closure Compiler:
node_modules/lodash/isBuffer.js
contains this bit of code:
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
Previously this would be rewritten as (when copied to builds/out-adv/node_modules/lodash/isBuffer.js
):
var freeModule$$module$Users$mfikes$Projects$clojurescript$node_modules$lodash$isBuffer=freeExports$$module$Users$mfikes$Projects$clojurescript$node_modules$lodash$isBuffer&&"object"=="object"&&module&&!module.nodeType&&module;
but with the change in Closure Compiler this is now rewritten as the following:
var freeModule$$module$Users$mfikes$Projects$clojurescript$node_modules$lodash$isBuffer=freeExports$$module$Users$mfikes$Projects$clojurescript$node_modules$lodash$isBuffer&&"object"=="object"&&{}&&!module.nodeType&&{};
In particular note that the sub-expression
module&&!module.nodeType&&module
becomes simply
{}&&!module.nodeType&&{}
with a dangling un-rewritten module
reference.
A theory is that Closure Compiler is looking for expressions involving module
to rewrite and misses or mishandles the bit of code in Lodash.
Mike Fikes July 1, 2018 at 10:43 PM
Bisected to this upstream commit https://github.com/google/closure-compiler/commit/3edafa4c1168d29894ad2ca6021eb72be6e73af5
Details
Details
Assignee
Reporter
Priority

If you use the latest Closure Compiler, tests will break with
ReferenceError: module is not defined
.Repro:
script/bootstrap --closure-compiler-snapshot
script/test
Note that this broke as of
closure-compiler-1.0-20180629.155739-322.jar
.