Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: $jscomp is not defined #40

Open
ccfontes opened this issue Feb 23, 2021 · 3 comments
Open

ReferenceError: $jscomp is not defined #40

ccfontes opened this issue Feb 23, 2021 · 3 comments

Comments

@ccfontes
Copy link

deps.edn:

{:aliases
  {:test {:extra-paths ["test"]
          :extra-deps {olical/cljs-test-runner {:mvn/version "3.8.0"}}
          :main-opts ["-m" "cljs-test-runner.main" "-c" "test.cljs.edn"]}}

test.cljs.edn:

{:optimizations :none
 :pretty-print  false
 :closure-defines {goog.DEBUG true}}

Works with :simple optimizations.

Breaks like this with :whitespace optimizations:

❯ clj -M:test -x chrome-headless
Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/cljs_test_runner.gen.js:7060:530

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/cljs_test_runner.gen.js:7060:530

Breaks likes this with :none optimizations:

❯ clj -M:test -x chrome-headless
23 02 2021 17:46:39.377:WARN [web-server]: 404: /cljs-test-runner-out/goog/deps.js
23 02 2021 17:46:39.388:WARN [web-server]: 404: /cljs-test-runner-out/cljs_deps.js
23 02 2021 17:46:39.421:WARN [web-server]: 404: /cljs-test-runner-out/cljs_deps.js
Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/object-assign/index.js:4:155

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/object-assign/index.js:4:155

Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/react/cjs/react.production.min.js:6:378

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/react/cjs/react.production.min.js:6:378

Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/react/cjs/react.development.js:7:42

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/react/cjs/react.development.js:7:42
      at cljs-test-runner-out/node_modules/react/cjs/react.development.js:90:15

Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.production.min.js:43:201

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.production.min.js:43:201

Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.development.js:35:171

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.development.js:35:171
      at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.development.js:989:15
@Olical
Copy link
Owner

Olical commented Feb 23, 2021

Hmm I can't say I've ever seen this or know what the issue is, it feels more ClojureScript compiler related than this repos code.

It actually seems more related to the Google Closure Compiler: https://stackoverflow.com/questions/57458122/how-to-fix-referenceerror-cant-find-variable-jscomp-phantomjs-or-refere

It might be worth trying to pin to a slightly older Clojure / ClojureScript version too 🤔 I wonder if any breaking changes were introduced that I'm not aware of? I'll try to dig deeper into this soon, but I'm really busy for the next few days at least I'm afraid.

@ccfontes
Copy link
Author

ccfontes commented Mar 6, 2021

@Olical Makes sense.
I'll only have time to try i.e., pinning an older ClojureScript compiler starting with next weekend.

@ccfontes
Copy link
Author

Gave it a go with a ClojureScript version from 2018 (1.10.145) without success.

Tried :output-feature-set :es6 as well, but the situation didn't change.

By the way, this is a Reagent project.

package.json:

"dependencies": {
   "react": "17.0.1",
   "react-dom": "17.0.1"
}

Do you think we should close the ticket? On my side it's OK because I only intend to run these tests in CI, and a longer build time is not such a big concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants