Fork me on GitHub
#cljsrn
<
2022-10-28
>
Shako Farhad01:10:14

I got this today when running Krell on ios emulator. Anyone else see this? App was working and reloading worked. So not sure if it is something to be ignored or not.

ERROR  Could not evaluate  [SyntaxError: 14:1:invalid statement encountered.]
 ERROR  Could not evaluate  [SyntaxError: 17:32:Invalid expression encountered]
 ERROR  Could not evaluate  [SyntaxError: 16:21:Invalid expression encountered]
 ERROR  Could not evaluate  [SyntaxError: 15:1:invalid statement encountered.]
 ERROR  Could not evaluate  [SyntaxError: 16:1:invalid statement encountered.]
 ERROR  Could not evaluate  [SyntaxError: 9:20:Invalid expression encountered]
 ERROR  Could not evaluate  [SyntaxError: 27:1:invalid statement encountered.]
 ERROR  Could not evaluate  [SyntaxError: 9:1:invalid statement encountered.]
 ERROR  Could not evaluate  [SyntaxError: 11:1:invalid statement encountered.]

xavi22:11:06

I have the same issue after upgrading from React Native 0.69.3 to 0.70.6 and Krell to 0.5.4 . The reported invalid statements happen in the`class` keyword. Ex. here are the first lines of safescript.js until the line with the class keyword where the error happens ...

/*TRANSPILED*/goog.loadModule(function(exports) {'use strict';/*

        Copyright The Closure Library Authors.
        SPDX-License-Identifier: Apache-2.0
        */
        'use strict';
        goog.module("goog.html.SafeScript");
        goog.module.declareLegacyNamespace();
        const Const = goog.require("goog.string.Const");
        const TypedString = goog.require("goog.string.TypedString");
        const trustedtypes = goog.require("goog.html.trustedtypes");
        const {fail} = goog.require("goog.asserts");
        const CONSTRUCTOR_TOKEN_PRIVATE = {};
        class SafeScript {
          constructor(value, token) {
          ...
Any idea about why this happens and/or how to get rid of it?

xavi22:11:38

I suspect it's because of Hermes, the new default JS engine since RN 0.70 https://reactnative.dev/blog/2022/09/05/version-070#hermes-as-default-engine

xavi22:11:32

Although it's not exactly the same issue that we find with ClojureScript, this is what led me to that https://github.com/facebook/hermes/issues/474

xavi22:11:00

I've just tried disabling Hermes in iOS ( https://reactnative.dev/docs/hermes#switching-back-to-javascriptcore ) . The errors disappear once Hermes is disabled.

joshmiller04:11:58

This is correct, Hermes does not support ES6 classes: https://github.com/facebook/hermes/issues/685

joshmiller04:11:52

Theoretically, I think you should be able to set the Closure compiler to output ES5 code and for it to work in Hermes, but it didn’t work immediately for me when I tried it and I didn’t have time to follow up.

joshmiller04:11:21

Does anyone know whether shadow-cljs works with Hermes? I don’t have any projects that use it.

thheller07:11:35

I do remember someone struggling with it. Not sure if that ever worked out though.

xavi19:11:56

Thanks! I understand the main benefit of Hermes is that the app starts faster. It would be great to be able to take advantage of that with ClojureScript apps... but for me it would be even greater to finish my app 🙂 so I 'm not going to spend time now trying to make the Closure compiler to output ES5 code.

joshmiller20:11:06

@U08QBRKUL Same. As it is now, startup is imperceptible for my app, so it would be a while until I actually needed some kind of boost from Hermes.

xavi22:11:06
replied to a thread:I got this today when running Krell on ios emulator. Anyone else see this? App was working and reloading worked. So not sure if it is something to be ignored or not. ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safescript.js> [SyntaxError: 14:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/trustedresourceurl.js> [SyntaxError: 17:32:Invalid expression encountered] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safeurl.js> [SyntaxError: 16:21:Invalid expression encountered] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safestyle.js> [SyntaxError: 15:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safestylesheet.js> [SyntaxError: 16:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/dom/tagname.js> [SyntaxError: 9:20:Invalid expression encountered] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safehtml.js> [SyntaxError: 27:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/collections/maps.js> [SyntaxError: 9:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/math/long.js> [SyntaxError: 11:1:invalid statement encountered.]

I have the same issue after upgrading from React Native 0.69.3 to 0.70.6 and Krell to 0.5.4 . The reported invalid statements happen in the`class` keyword. Ex. here are the first lines of safescript.js until the line with the class keyword where the error happens ...

/*TRANSPILED*/goog.loadModule(function(exports) {'use strict';/*

        Copyright The Closure Library Authors.
        SPDX-License-Identifier: Apache-2.0
        */
        'use strict';
        goog.module("goog.html.SafeScript");
        goog.module.declareLegacyNamespace();
        const Const = goog.require("goog.string.Const");
        const TypedString = goog.require("goog.string.TypedString");
        const trustedtypes = goog.require("goog.html.trustedtypes");
        const {fail} = goog.require("goog.asserts");
        const CONSTRUCTOR_TOKEN_PRIVATE = {};
        class SafeScript {
          constructor(value, token) {
          ...
Any idea about why this happens and/or how to get rid of it?

joshmiller04:11:21
replied to a thread:I got this today when running Krell on ios emulator. Anyone else see this? App was working and reloading worked. So not sure if it is something to be ignored or not. ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safescript.js> [SyntaxError: 14:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/trustedresourceurl.js> [SyntaxError: 17:32:Invalid expression encountered] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safeurl.js> [SyntaxError: 16:21:Invalid expression encountered] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safestyle.js> [SyntaxError: 15:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safestylesheet.js> [SyntaxError: 16:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/dom/tagname.js> [SyntaxError: 9:20:Invalid expression encountered] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/html/safehtml.js> [SyntaxError: 27:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/collections/maps.js> [SyntaxError: 9:1:invalid statement encountered.] ERROR Could not evaluate <http://192.168.0.24:8081/target/goog/math/long.js> [SyntaxError: 11:1:invalid statement encountered.]

Does anyone know whether shadow-cljs works with Hermes? I don’t have any projects that use it.