thheller / shadow-cljs

ClojureScript compilation made easy
https://github.com/thheller/shadow-cljs
Eclipse Public License 1.0
2.23k stars 173 forks source link

Compiling squint-cljs (via @nextjournal/clojure-mode) on 2.27.1 throws ICE #1170

Closed meeseekz closed 2 weeks ago

meeseekz commented 5 months ago

Still worked on 2.26.7

repro: https://github.com/meeseekz/shadow-issue-squint

{
  "devDependencies": {
    "shadow-cljs": "2.27.1"
  },
  "dependencies": {
    "@nextjournal/clojure-mode": "0.3.1"
  }
}
(ns app (:require ["@nextjournal/clojure-mode" :as clj-mode]))

(defn init! []
  (js/console.log clj-mode/language_support))
{:dependencies []
 :source-paths ["src/"]
 :dev-http {3000 {:root "resources/public/"}}
 :builds
 {:app {:target :esm

        :modules {:main {:init-fn app/init!}}

        :build-hooks [(shadow.cljs.build-report/hook
                       {:output-to "build-report.html"})]

        :output-dir "resources/public/shadow-js/"
        :asset-path "/shadow-js/"}}}
npx shadow-cljs release app --verbose
[:app] Compiling ...
-> build target: :esm stage: :configure
<- build target: :esm stage: :configure (3 ms)
-> build hook: [0 shadow.cljs.build-report/hook] stage: :configure
<- build hook: [0 shadow.cljs.build-report/hook] stage: :configure (6 ms)
-> Resolving Module: :main
<- Resolving Module: :main (460 ms)
-> build target: :esm stage: :compile-prepare
<- build target: :esm stage: :compile-prepare (6 ms)
-> Shadow JS converting 25 JS sources
failed to convert sources
{:tag :shadow.build.closure/convert-error, :sources [[:shadow.build.npm/resource "node_modules/squint-cljs/src/squint/core.js"] [:shadow.build.npm/resource "node_modules/squint-cljs/core.js"] [:shadow.build.npm/resource "node_modules/@lezer/common/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/@codemirror/state/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/style-mod/dist/style-mod.cjs"] [:shadow.build.npm/resource "node_modules/w3c-keyname/index.cjs"] [:shadow.build.npm/resource "node_modules/@codemirror/view/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/@lezer/highlight/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/@codemirror/language/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/process/browser.js"] [:shadow.build.npm/resource "node_modules/@lezer/lr/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/lezer-clojure/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/squint-cljs/src/squint/string.js"] [:shadow.build.npm/resource "node_modules/@lezer/markdown/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/selections.mjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/util.mjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/node.mjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/extensions/close_brackets.mjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/extensions/formatting.mjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/extensions/match_brackets.mjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/extensions/selection_history.mjs"] [:shadow.build.npm/resource "node_modules/@codemirror/commands/dist/index.cjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/commands.mjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode/keymap.mjs"] [:shadow.build.npm/resource "node_modules/@nextjournal/clojure-mode/dist/nextjournal/clojure_mode.mjs"]]}
ExceptionInfo: failed to convert sources
    shadow.build.closure/convert-sources-simple*/fn--13152 (closure.clj:2072)
    shadow.build.closure/convert-sources-simple* (closure.clj:2059)
    shadow.build.closure/convert-sources-simple* (closure.clj:1923)
    shadow.build.closure/convert-sources-simple (closure.clj:[223](https://github.com/meeseekz/shadow-issue-squint/actions/runs/7652752576/job/20853180719#step:4:224)3)
    shadow.build.closure/convert-sources-simple (closure.clj:2183)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1357)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1350)
    shadow.build.compiler/compile-all (compiler.clj:1606)
    shadow.build.compiler/compile-all (compiler.clj:1469)
    shadow.build.api/compile-sources (api.clj:261)
    shadow.build.api/compile-sources (api.clj:253)
    shadow.build/compile (build.clj:512)
    shadow.build/compile (build.clj:493)
    shadow.cljs.devtools.api/release* (api.clj:338)
    shadow.cljs.devtools.api/release* (api.clj:324)
    shadow.cljs.devtools.cli-actual/do-build-command (cli_actual.clj:28)
    shadow.cljs.devtools.cli-actual/do-build-command (cli_actual.clj:25)
    shadow.cljs.devtools.cli-actual/do-build-commands (cli_actual.clj:49)
    shadow.cljs.devtools.cli-actual/do-build-commands (cli_actual.clj:38)
    shadow.cljs.devtools.cli-actual/main/body-fn--16574--auto----17239 (cli_actual.clj:166)
    shadow.cljs.devtools.cli-actual/main (cli_actual.clj:165)
    shadow.cljs.devtools.cli-actual/main (cli_actual.clj:132)
    clojure.core/apply (core.clj:671)
    clojure.core/apply (core.clj:662)
    shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:219)
    shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:217)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core/apply (core.clj:667)
    clojure.core/apply (core.clj:662)
    shadow.cljs.devtools.cli/-main (cli.clj:75)
    shadow.cljs.devtools.cli/-main (cli.clj:67)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core/apply (core.clj:667)
    clojure.main/main-opt (main.clj:514)
    clojure.main/main-opt (main.clj:510)
    clojure.main/main (main.clj:664)
    clojure.main/main (main.clj:616)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)
Caused by:
RuntimeException: INTERNAL COMPILER ERROR.
Please report this problem.

null
  Node(COMPUTED_PROP): node_modules/squint-cljs/src/squint/core.js:1550:10
  return {[IIterable]:true, [IIterable__iterator]:args.length == 1 ? function*() {
  Parent(OBJECTLIT): node_modules/squint-cljs/src/squint/core.js:1550:9
  return {[IIterable]:true, [IIterable__iterator]:args.length == 1 ? function*() {

    com.google.javascript.jscomp.Compiler.throwInternalError (Compiler.java:3280)
    com.google.javascript.jscomp.NodeTraversal.throwUnexpectedException (NodeTraversal.java:516)
    com.google.javascript.jscomp.NodeTraversal.traverse (NodeTraversal.java:536)
    com.google.javascript.jscomp.NodeTraversal$Builder.traverse (NodeTraversal.java:472)
    com.google.javascript.jscomp.NodeTraversal.traverse (NodeTraversal.java:542)
    com.google.javascript.jscomp.RewriteClassMembers.process (RewriteClassMembers.java:56)
    com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process (PhaseOptimizer.java:240)
    com.google.javascript.jscomp.PhaseOptimizer.process (PhaseOptimizer.java:179)
    com.google.javascript.jscomp.Compiler.performTranspilationAndOptimizations (Compiler.java:2966)
    com.google.javascript.jscomp.Compiler.lambda$stage2Passes$7 (Compiler.java:1025)
    com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread (CompilerExecutor.java:126)
    com.google.javascript.jscomp.Compiler.runInCompilerThread (Compiler.java:1073)
    com.google.javascript.jscomp.Compiler.stage2Passes (Compiler.java:1022)
    com.google.javascript.jscomp.Compiler.compile (Compiler.java:908)
    jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
    jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke (Method.java:566)
    clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:167)
    clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:102)
    shadow.build.closure/convert-sources-simple*/fn--13152/fn--13153 (closure.clj:2062)
    shadow.build.closure/convert-sources-simple*/fn--13152 (closure.clj:2060)
    shadow.build.closure/convert-sources-simple* (closure.clj:2059)
    shadow.build.closure/convert-sources-simple* (closure.clj:1923)
    shadow.build.closure/convert-sources-simple (closure.clj:2[233](https://github.com/meeseekz/shadow-issue-squint/actions/runs/7652752576/job/20853180719#step:4:234))
    shadow.build.closure/convert-sources-simple (closure.clj:2183)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1357)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1350)
    shadow.build.compiler/compile-all (compiler.clj:1606)
    shadow.build.compiler/compile-all (compiler.clj:1469)
    shadow.build.api/compile-sources (api.clj:261)
    shadow.build.api/compile-sources (api.clj:253)
    shadow.build/compile (build.clj:512)
    shadow.build/compile (build.clj:493)
    shadow.cljs.devtools.api/release* (api.clj:338)
    shadow.cljs.devtools.api/release* (api.clj:324)
    shadow.cljs.devtools.cli-actual/do-build-command (cli_actual.clj:28)
    shadow.cljs.devtools.cli-actual/do-build-command (cli_actual.clj:25)
    shadow.cljs.devtools.cli-actual/do-build-commands (cli_actual.clj:49)
    shadow.cljs.devtools.cli-actual/do-build-commands (cli_actual.clj:38)
    shadow.cljs.devtools.cli-actual/main/body-fn--16574--auto----17239 (cli_actual.clj:166)
    shadow.cljs.devtools.cli-actual/main (cli_actual.clj:165)
    shadow.cljs.devtools.cli-actual/main (cli_actual.clj:132)
    clojure.core/apply (core.clj:671)
    clojure.core/apply (core.clj:662)
    shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:219)
    shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:217)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core/apply (core.clj:667)
    clojure.core/apply (core.clj:662)
    shadow.cljs.devtools.cli/-main (cli.clj:75)
    shadow.cljs.devtools.cli/-main (cli.clj:67)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core/apply (core.clj:667)
    clojure.main/main-opt (main.clj:514)
    clojure.main/main-opt (main.clj:510)
    clojure.main/main (main.clj:664)
    clojure.main/main (main.clj:616)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)
Caused by:
IllegalStateException: 
    com.google.common.base.Preconditions.checkState (Preconditions.java:496)
    com.google.javascript.jscomp.RewriteClassMembers.shouldTraverse (RewriteClassMembers.java:99)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:927)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:951)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:951)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:951)
    com.google.javascript.jscomp.NodeTraversal.traverseFunction (NodeTraversal.java:1006)
    com.google.javascript.jscomp.NodeTraversal.handleFunction (NodeTraversal.java:857)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:903)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:951)
    com.google.javascript.jscomp.NodeTraversal.traverseFunction (NodeTraversal.java:1006)
    com.google.javascript.jscomp.NodeTraversal.handleFunction (NodeTraversal.java:857)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:903)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:951)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:951)
    com.google.javascript.jscomp.NodeTraversal.traverseChildren (NodeTraversal.java:1134)
    com.google.javascript.jscomp.NodeTraversal.handleScript (NodeTraversal.java:845)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:900)
    com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:951)
    com.google.javascript.jscomp.NodeTraversal.traverse (NodeTraversal.java:533)
    com.google.javascript.jscomp.NodeTraversal$Builder.traverse (NodeTraversal.java:472)
    com.google.javascript.jscomp.NodeTraversal.traverse (NodeTraversal.java:542)
    com.google.javascript.jscomp.RewriteClassMembers.process (RewriteClassMembers.java:56)
    com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process (PhaseOptimizer.java:240)
    com.google.javascript.jscomp.PhaseOptimizer.process (PhaseOptimizer.java:179)
    com.google.javascript.jscomp.Compiler.performTranspilationAndOptimizations (Compiler.java:2966)
    com.google.javascript.jscomp.Compiler.lambda$stage2Passes$7 (Compiler.java:1025)
    com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread (CompilerExecutor.java:126)
    com.google.javascript.jscomp.Compiler.runInCompilerThread (Compiler.java:1073)
    com.google.javascript.jscomp.Compiler.stage2Passes (Compiler.java:1022)
    com.google.javascript.jscomp.Compiler.compile (Compiler.java:908)
    jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
    jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke (Method.java:566)
    clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:167)
    clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:102)
    shadow.build.closure/convert-sources-simple*/fn--13152/fn--13153 (closure.clj:2062)
    shadow.build.closure/convert-sources-simple*/fn--13152 (closure.clj:2060)
    shadow.build.closure/convert-sources-simple* (closure.clj:2059)
    shadow.build.closure/convert-sources-simple* (closure.clj:1923)
    shadow.build.closure/convert-sources-simple (closure.clj:2233)
    shadow.build.closure/convert-sources-simple (closure.clj:2183)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1357)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1350)
    shadow.build.compiler/compile-all (compiler.clj:1606)
    shadow.build.compiler/compile-all (compiler.clj:1469)
    shadow.build.api/compile-sources (api.clj:261)
    shadow.build.api/compile-sources (api.clj:253)
    shadow.build/compile (build.clj:512)
    shadow.build/compile (build.clj:493)
    shadow.cljs.devtools.api/release* (api.clj:338)
    shadow.cljs.devtools.api/release* (api.clj:324)
    shadow.cljs.devtools.cli-actual/do-build-command (cli_actual.clj:28)
    shadow.cljs.devtools.cli-actual/do-build-command (cli_actual.clj:25)
    shadow.cljs.devtools.cli-actual/do-build-commands (cli_actual.clj:49)
    shadow.cljs.devtools.cli-actual/do-build-commands (cli_actual.clj:38)
    shadow.cljs.devtools.cli-actual/main/body-fn--16574--auto----17[239](https://github.com/meeseekz/shadow-issue-squint/actions/runs/7652752576/job/20853180719#step:4:240) (cli_actual.clj:166)
    shadow.cljs.devtools.cli-actual/main (cli_actual.clj:165)
    shadow.cljs.devtools.cli-actual/main (cli_actual.clj:132)
    clojure.core/apply (core.clj:671)
    clojure.core/apply (core.clj:662)
    shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:219)
    shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:217)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core/apply (core.clj:667)
    clojure.core/apply (core.clj:662)
    shadow.cljs.devtools.cli/-main (cli.clj:75)
    shadow.cljs.devtools.cli/-main (cli.clj:67)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core/apply (core.clj:667)
    clojure.main/main-opt (main.clj:514)
    clojure.main/main-opt (main.clj:510)
    clojure.main/main (main.clj:664)
    clojure.main/main (main.clj:616)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)
thheller commented 5 months ago

2.27.1 included an upgrade in the Closure Compiler, which I guess if the problem here.

I'll see if I can figure something out, or maybe downgrade the GCC version again.

scarytom commented 5 months ago

This is also breaking our build too. Same error, but on chart.js


  Node(COMPUTED_PROP): node_modules/chart_DOT_js/dist/chart.cjs:509:16
        const { [iAxis]: index , [vAxis]: value  } = item;
  Parent(OBJECT_PATTERN): node_modules/chart_DOT_js/dist/chart.cjs:509:14
        const { [iAxis]: index , [vAxis]: value  } = item;```
thheller commented 5 months ago

One temporary fix is setting :compiler-options {:output-feature-set :es-unstable}, which just disables the problematic RewriteClassMembers compiler pass.

Still trying to figure out if I can maybe tweak this, so I don't have to do a rollback of the Closure Compiler version.

svdo commented 5 months ago

FYI: I'm also getting that "failed to convert sources" error, but on a different package:

Caused by:
NullPointerException: NAME a$jscomp$578 2:4095  [length: 1] [source_file: node_modules/react-hook-form/dist/index.cjs.js] [original_name: a]

Full trace:

ExceptionInfo: failed to convert sources
    shadow.build.closure/convert-sources-simple*/fn--90216 (closure.clj:2072)
    shadow.build.closure/convert-sources-simple* (closure.clj:2059)
    shadow.build.closure/convert-sources-simple* (closure.clj:1923)
    shadow.build.closure/convert-sources-simple (closure.clj:2233)
    shadow.build.closure/convert-sources-simple (closure.clj:2183)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1357)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1350)
    shadow.build.compiler/compile-all (compiler.clj:1606)
    shadow.build.compiler/compile-all (compiler.clj:1469)
    shadow.build.api/compile-sources (api.clj:261)
    shadow.build.api/compile-sources (api.clj:253)
    shadow.build/compile (build.clj:512)
    shadow.build/compile (build.clj:493)
    shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:368)
    shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:349)
    shadow.cljs.devtools.server.worker.impl/eval93007/fn--93009 (impl.clj:448)
    clojure.lang.MultiFn.invoke (MultiFn.java:234)
    shadow.cljs.devtools.server.util/server-thread/fn--92765/fn--92766/fn--92774 (util.clj:283)
    shadow.cljs.devtools.server.util/server-thread/fn--92765/fn--92766 (util.clj:282)
    shadow.cljs.devtools.server.util/server-thread/fn--92765 (util.clj:255)
    java.lang.Thread.run (Thread.java:1583)
Caused by:
NullPointerException: NAME a$jscomp$578 2:4095  [length: 1] [source_file: node_modules/react-hook-form/dist/index.cjs.js] [original_name: a]
    com.google.common.base.Preconditions.checkNotNull (Preconditions.java:921)
    com.google.javascript.jscomp.RemoveUnusedCode.getVarForNameNode (RemoveUnusedCode.java:858)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseNameNode (RemoveUnusedCode.java:711)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:535)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren (RemoveUnusedCode.java:1262)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseCall (RemoveUnusedCode.java:769)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:463)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren (RemoveUnusedCode.java:1262)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:547)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren (RemoveUnusedCode.java:1262)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseFunction (RemoveUnusedCode.java:1414)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:432)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren (RemoveUnusedCode.java:1262)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseCall (RemoveUnusedCode.java:769)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:463)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren (RemoveUnusedCode.java:1262)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:547)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren (RemoveUnusedCode.java:1262)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:547)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren (RemoveUnusedCode.java:1262)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseFunction (RemoveUnusedCode.java:1414)
    com.google.javascript.jscomp.RemoveUnusedCode$Continuation.apply (RemoveUnusedCode.java:1774)
    com.google.javascript.jscomp.RemoveUnusedCode.traverseAndRemoveUnusedReferences (RemoveUnusedCode.java:378)
    com.google.javascript.jscomp.RemoveUnusedCode.process (RemoveUnusedCode.java:352)
    com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process (PhaseOptimizer.java:240)
    com.google.javascript.jscomp.PhaseOptimizer$Loop.process (PhaseOptimizer.java:378)
    com.google.javascript.jscomp.PhaseOptimizer.process (PhaseOptimizer.java:179)
    com.google.javascript.jscomp.Compiler.performTranspilationAndOptimizations (Compiler.java:2966)
    com.google.javascript.jscomp.Compiler.lambda$stage2Passes$7 (Compiler.java:1025)
    com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread (CompilerExecutor.java:126)
    com.google.javascript.jscomp.Compiler.runInCompilerThread (Compiler.java:1073)
    com.google.javascript.jscomp.Compiler.stage2Passes (Compiler.java:1022)
    com.google.javascript.jscomp.Compiler.compile (Compiler.java:908)
    jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    java.lang.reflect.Method.invoke (Method.java:580)
    clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:167)
    clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:102)
    shadow.build.closure/convert-sources-simple*/fn--90216/fn--90217 (closure.clj:2062)
    shadow.build.closure/convert-sources-simple*/fn--90216 (closure.clj:2060)
    shadow.build.closure/convert-sources-simple* (closure.clj:2059)
    shadow.build.closure/convert-sources-simple* (closure.clj:1923)
    shadow.build.closure/convert-sources-simple (closure.clj:2233)
    shadow.build.closure/convert-sources-simple (closure.clj:2183)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1357)
    shadow.build.compiler/maybe-closure-convert (compiler.clj:1350)
    shadow.build.compiler/compile-all (compiler.clj:1606)
    shadow.build.compiler/compile-all (compiler.clj:1469)
    shadow.build.api/compile-sources (api.clj:261)
    shadow.build.api/compile-sources (api.clj:253)
    shadow.build/compile (build.clj:512)
    shadow.build/compile (build.clj:493)
    shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:368)
    shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:349)
    shadow.cljs.devtools.server.worker.impl/eval93007/fn--93009 (impl.clj:448)
    clojure.lang.MultiFn.invoke (MultiFn.java:234)
    shadow.cljs.devtools.server.util/server-thread/fn--92765/fn--92766/fn--92774 (util.clj:283)
    shadow.cljs.devtools.server.util/server-thread/fn--92765/fn--92766 (util.clj:282)
    shadow.cljs.devtools.server.util/server-thread/fn--92765 (util.clj:255)
    java.lang.Thread.run (Thread.java:1583)
svdo commented 5 months ago

That :output-feature-set :es-unstable makes it work for me as well by the way. Is that suitable for production builds would you say?

thheller commented 5 months ago

Hmm react-hook-form works fine for me, even without that :output-feature-set.

Wether this is suitable for production or not I cannot say. Not sure which kind of features the code is actually using and how far back you need to go with browser support. The problematic feature on the other two is well supported in all browsers, so that should be fine. Still best to test though.

thheller commented 5 months ago

I just released version 2.27.2, which downgrades the Closure Compiler version back to the previous working one.

I could not figure out why this fails. Using the npm google-closure-compiler to compile squint-cljs/core works just fine without issue. I'll revisit this with the next closure compiler release. Hopefully it fixes itself then.

thheller commented 3 months ago

I just cut a new 2.28.2 release, using the recently released v20240317 closure-compiler version. It appears that the packages previously failing now compiled. Please give it a try and report back problems.

svdo commented 3 months ago

@thheller I just tried with the new version; it gives the same error for me I'm afraid (when using :es8).

thheller commented 3 months ago

Any particular reason you are setting :es8?

I'm really not keen on downgrading again since this version also fixes some other issues.

scarytom commented 3 months ago

The new version seems to work perfectly for us, thanks

svdo commented 3 months ago

Any particular reason you are setting :es8?

I'm really not keen on downgrading again since this version also fixes some other issues.

No not really. This is in development mode only. Not sure why it's there. What do you normally use for development?

thheller commented 3 months ago

I'd set the same value for development as in production, which should correspond for the Browser version you are expected to support. It makes zero sense to only set it for development, ever to any value.

If you have to support IE11, which noone should nowadays, then you need to set :es5 probably.

If you just want to support modern browsers don't set it to anything at all. The default is :es2020 which is already extemely conservative, given that browsers nowadays auto update and having 4 year old versions is uncommon and many browsers supported ES2020 features long before the ES2020 spec was finalized.

You can increase it higher if your know your audience is going to have up-to-date browsers, e.g. for internal UIs. I stick to the default, since it doesn't matter whatsoever for CLJS and is usually only used for JS deps that want to use cutting edge JS features that might be a bit too cutting edge for the average user.

ES2020 is what I would consider safe and my condolences to anyone having to support lower.

svdo commented 3 months ago

Thanks for your detailed answer Thomas! I just verified that the default now also works. A while back we needed to add the output features set because of some library IIRC, but apparently it's no longer needed. So all good now! :)