Fork me on GitHub
#cljs-dev
<
2021-07-30
>
mikerod14:07:02

I posted this on #clojurescript but didn’t get much input and it’s possible it could be relevant here instead, given the compiler-side sort of expertise here: When upgrading from clojurescript v 1.10.764 to 1.10.866 , which notably had 2 goog closure lib upgrades I note with a dev figwheel style build (latest lein-figwheel + cljsbuild) that I suddenly get

Uncaught SyntaxError: Unexpected token '!'
Digging deeper the devtools difference I see in the browser is in the file: <js-compilation-location>/dev/goog/log/log.js I tried the same and got the same issue with 1.10.844 The odd part is in the old cljs version, this file looked like the direct source JS file from google closure lib. In the new cljs version, it instead showing me some transpiled variant, with a header like this:
/*TRANSPILED*//*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
Then the actual offending line is here (with the name truncated a bit):
/*TRANSPILED*//*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
goog.provide("goog.log");
goog.provide("goog.log.Level");
goog.provide("goog.log.LogBuffer");
goog.provide("goog.log.LogRecord");
goog.provide("goog.log.Logger");
goog.require("goog.asserts");
goog.require("goog.debug");
goog.log.Loggable;
goog.log.ENABLED = goog.define("goog.log.ENABLED", goog.debug.LOGGING_ENABLED);
goog.log.ROOT_LOGGER_NAME = "";
var file_$Users$myuser$_m2$repository$org$clojure$google_closure_library$0_0_20201211_3e6c510d$google_closure_library_0_0_20201211_3e6c510d_jar!$goog$log$log$classdecl$var0 = function(name, value) {
  this.name = name;
  this.value = value;
};
You can see in the long var name in the transpiled one there is an “!” used in the name. I don’t know that that’s even a legal JS identifier. This looks to be what is reported. I don’t understand why previously I don’t see this “transpiled” file at all, but with the cljs upgrade now I do. So why it exist now is the first real mystery to me. The second is why it’s producing this invalid name.

danieroux15:07:56

I ran into this, what fixed it in my case was removing :language-out :es5

mikerod15:07:13

Oh wow. That’s interesting. We have that constraint as well. I think it’s necessary to support IE11 which we still are attempting to do.

mikerod15:07:21

I will test this out though. I appreciate the tip off!