Closed meeseekz closed 2 weeks 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.
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;```
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.
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)
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?
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.
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.
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.
@thheller I just tried with the new version; it gives the same error for me I'm afraid (when using :es8
).
Any particular reason you are setting :es8
?
I'm really not keen on downgrading again since this version also fixes some other issues.
The new version seems to work perfectly for us, thanks
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?
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.
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! :)
Still worked on 2.26.7
repro: https://github.com/meeseekz/shadow-issue-squint