Fork me on GitHub
#shadow-cljs
<
2022-01-14
>
joshuamz05:01:09

Hi. I created a minimal shadow project configured with :external JS provider and configured Webpack for the final bundle phase. I have one dependency that relies on React and ReactDOM (both v16.x) among others. However, when I release the build with shadow-cljs, I get the following warning:

> shadow-cljs release web
(...)
[:web] Compiling ...
------ WARNING #1 -  -----------------------------------------------------------
 Resource: shadow.js.shim.module$react_dom.js:3:34
 variable shadow$bridge is undeclared
--------------------------------------------------------------------------------
nil
[:web] Build completed. (...)
Am I missing something in this configuration? I'm using shadow-cljs v2.16.12. You can get more details from this Github issue: https://github.com/thheller/shadow-cljs/issues/978 Looking up in this channel, I found someone that got the same warning https://clojurians.slack.com/archives/C6N245JGG/p1632299596117200, but I couldn't find any more references on this matter. Thanks for your time reading this report.

restenb11:01:16

is there a way to tell the shadow-cljscli to write the output of shadow-cljs pomto a different file than pom.xml?

thheller11:01:03

@restenb there is not no. if you already have a pom.xml it is likely you shouldn't be calling that task?

restenb12:01:58

i have a leiningen project.clj backend with shadow-cljs.end used for frontend deps only. it was added late in the project to get node support

restenb12:01:58

but the pipeline generates with lein pom and uses that for certain things. so it'd be nice to output the shadow deps somewhere else

thheller12:01:54

I don't understand the problem then? neither project.clj nor shadow-cljs.edn use pom.xml for anything?

restenb12:01:40

the build pipeline does, so pom.xml gets overwritten there since both shadow-cljs pom and lein pom have to be run. it's not a huge problem, just curious

restenb12:01:14

lein pom doesn't support changing the output name either, so here we are ๐Ÿ˜›

restenb13:01:36

where does shadow-cljs get the artifactId and groupId it generates from? right now it's groupId=artifactId=directoryName it seems? can this be changed?

David Pham15:01:23

Hello everyone, did anyone see the same error in advanced compilation?

NullPointerException: NAME module$contents$goog$testing$storage$FakeMechanism_FakeMechanism 94:10  [length: 13] [source_file: goog/testing/storage/fakemechanism.js] [original_name: FakeMechanism]

David Pham15:01:49

Shadow-cljs version 2.16.12

thheller15:01:04

whats the rest of the stacktrace?

David Pham15:01:46

NullPointerException: NAME module$contents$goog$testing$storage$FakeMechanism_FakeMechanism 94:10  [length: 13] [source_file: goog/testing/storage/fakemechanism.js] [original_name: FakeMechanism]
	com.google.common.base.Preconditions.checkNotNull (Preconditions.java:897)
	com.google.javascript.jscomp.RemoveUnusedCode.getVarForNameNode (RemoveUnusedCode.java:895)
	com.google.javascript.jscomp.RemoveUnusedCode.traverseNameNode (RemoveUnusedCode.java:751)
	com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:571)
	com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren (RemoveUnusedCode.java:1305)
	com.google.javascript.jscomp.RemoveUnusedCode.traverseNode (RemoveUnusedCode.java:581)
	com.google.javascript.jscomp.RemoveUnusedCode.access$1200 (RemoveUnusedCode.java:83)
	com.google.javascript.jscomp.RemoveUnusedCode$Continuation.apply (RemoveUnusedCode.java:1829)
	com.google.javascript.jscomp.RemoveUnusedCode.traverseAndRemoveUnusedReferences (RemoveUnusedCode.java:412)
	com.google.javascript.jscomp.RemoveUnusedCode.process (RemoveUnusedCode.java:386)
	com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process (PhaseOptimizer.java:317)
	com.google.javascript.jscomp.PhaseOptimizer$Loop.process (PhaseOptimizer.java:462)
	com.google.javascript.jscomp.PhaseOptimizer.process (PhaseOptimizer.java:232)
	com.google.javascript.jscomp.Compiler.performTranspilationAndOptimizations (Compiler.java:2592)
	com.google.javascript.jscomp.Compiler.lambda$stage2Passes$8 (Compiler.java:966)
	com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread (CompilerExecutor.java:127)
	com.google.javascript.jscomp.Compiler.runInCompilerThread (Compiler.java:1014)
	com.google.javascript.jscomp.Compiler.stage2Passes (Compiler.java:963)
	com.google.javascript.jscomp.Compiler.compileModules (Compiler.java:905)
	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:564)
	clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:167)
	clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:102)
	shadow.build.closure/compile-js-modules (closure.clj:1102)
	shadow.build.closure/compile-js-modules (closure.clj:1088)
	shadow.build.closure/optimize/fn--12464 (closure.clj:1297)
	shadow.build.closure/optimize (closure.clj:1283)
	shadow.build.closure/optimize (closure.clj:1274)
	shadow.build.api/optimize (api.clj:273)
	shadow.build.api/optimize (api.clj:267)
	shadow.build/optimize (build.clj:476)
	shadow.build/optimize (build.clj:468)
	shadow.cljs.devtools.api/release* (api.clj:339)
	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--17177--auto----17893 (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)

thheller16:01:50

@neo2551 are you sure you are on 2.16.12? I have seen this stacktrace before but that was fixed a while ago? might be something unrelated of course, just checking

David Pham16:01:06

Yes I am sure. I can just try again. I used 2.15.2 and it was working.

thheller16:01:44

well that bump would include a closure compiler version bump. it had a bunch of other issues so no surprise there

David Pham16:01:09

It magically works now ๐Ÿ˜•

David Pham16:01:43

Yep, it works now ๐Ÿ˜• I am sorry, for the disturbance...

thheller16:01:03

it might be an issue with incremental compilation. there have been a few of those. if it happens again try wiping .shadow-cljs/builds/<your-build-id> and recompile. please let me know if that fixes it