# Shadow-cljs 2.25.2 looking for testers

**URL:** https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206
**Category:** shadow-cljs
**Created:** [July 26, 2023, 9:42am UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206 "2023-07-26T09:42:15Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![thheller](https://clojureverse.org/user_avatar/clojureverse.org/thheller/32/534_2.png) [@thheller](https://clojureverse.org/u/thheller)
#### Post date: [July 26, 2023, 9:42am UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/1 "2023-07-26T09:42:16Z")

</div>

**Update: Fixed a couple issues, try 2.25.2**

I don’t usually do these release announcements, but I just released version `2.25.2` of [shadow-cljs](https://github.com/thheller/shadow-cljs) and it includes a fairly significant change, where I’d like to crowdsource some more testing. Ideally nobody will notice a thing, but history has taught me that there is a lot of weird code on `npm` and I probably didn’t account for all of it.

The release changes how ES Modules from `node_modules` are processed. If that doesn’t mean anything to you that is fine, you shouldn’t need to know how any of this works. **Just verify that your build still works and report back if you get new (possibly strange) errors.**

If you are interested in some background: There is some code published to `npm` as “modern” ESM code, meaning files that include `import` and `export` vs. the older much more common CommonJS style that uses `require` and `module.exports` or just `exports`. Trouble is that these two systems are fundamentally incompatible, so the code needs to be rewritten.

I opted to stay with the common approach of rewriting `import/export` to `require/exports`, i.e. rewriting ESM to CommonJS. All of this was previously handled by starting a background `node` process which then ran a precompiled version of the [babel-worker](https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/npm/babel_worker.cljs) script, which basically just called [babel](https://babeljs.io/). Each ESM file was then sent to the node process, converted and sent back. Not perfect, but did the trick.

I always hated this approach and wanted to get rid of it since I wrote it. However, at the time investigating what babel actually did and replicating the same in my own code was substantially more work. It also was at a time where it wasn’t totally clear where this was headed and just staying with babel seemed best.

Nowadays things have settled down and things haven’t changed much. I also figured out what babel actually did over time and decided it was time to implement everything directly. Most code actually already existed in the Closure Compiler, so rewriting it to what shadow-cljs needs wasn’t all that much work.

The old babel path is now behind a flag `:js-options {:use-babel true}`, but the goal is to drop that entire infrastructure at some point. Please note that this was only ever really used for rewriting ESM to CJS, not running babel in some generic way.

**Please upgrade to 2.25.2 and report back any breakage**. Unfortunately this is a fairly low level change, so the symptoms it may surface can be rather widespread and weird. If you use a lot of `npm` packages you are more likely to be affected by this. I tested a few common packages which appeared to work fine, but I can’t test them all. Ideally everything still works and will probably be a lot faster too.

---

<div class="post-metadata">

### Author: ![zk1](https://clojureverse.org/user_avatar/clojureverse.org/zk1/32/2171_2.png) [@zk1](https://clojureverse.org/u/zk1)
#### Post date: [July 27, 2023, 9:31pm UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/2 "2023-07-27T21:31:52Z")

</div>

Tested on an electron app project, seems like it built correctly.

> <https://gist.github.com/zk/aa93cf67d9291c56b9d2796aa079ed0b>

LMK if there’s anything specific to test past build.

---

<div class="post-metadata">

### Author: ![thheller](https://clojureverse.org/user_avatar/clojureverse.org/thheller/32/534_2.png) [@thheller](https://clojureverse.org/u/thheller)
#### Post date: [July 28, 2023, 5:12am UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/3 "2023-07-28T05:12:18Z")

</div>

Your log is showing

```auto
shadow-cljs - server version: 2.19.0 running at http://localhost:9630

```

So, you are not running `2.25.2`. Looks like you are using `deps.edn`, in which case you need to upgrade the `thheller/shadow-cljs` dependency there.

Compilation is probably going to be fine, need to find out about runtime issues.

---

<div class="post-metadata">

### Author: ![DerGuteMoritz](https://clojureverse.org/user_avatar/clojureverse.org/dergutemoritz/32/5137_2.png) [@DerGuteMoritz](https://clojureverse.org/u/DerGuteMoritz)
#### Post date: [August 1, 2023, 2:08pm UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/4 "2023-08-01T14:08:56Z")

</div>

```auto
$ ls $NODE_PATH | wc -l
286

$ shadow-cljs --cli-info                                                
shadow-cljs - config: /redacted/shadow-cljs.edn
=== Version
jar: 2.25.2
cli: 2.25.2
deps: 1.3.4
config-version: 2.25.2

=== Paths
cli: /nix/store/1vrmzm3p4kipm30bi88k875fcasbv1b0-node-dependencies-redacted-0.0.0/lib/node_modules/shadow-cljs/cli/dist.js
config: /redacted/shadow-cljs.edn
project: /redacted
cache: .shadow-cljs

=== Java
openjdk version "19.0.2" 2023-01-17
OpenJDK Runtime Environment (build 19.0.2+7-nixos)
OpenJDK 64-Bit Server VM (build 19.0.2+7-nixos, mixed mode, sharing)

=== Source Paths

$ shadow-cljs compile tests                                  
shadow-cljs - config: /redacted/shadow-cljs.edn
shadow-cljs - starting via "clojure"
[:tests] Compiling ...
========= Running Tests =======================

[... redacted ...]

Ran 166 tests containing 766 assertions.
0 failures, 0 errors.
===============================================
[:tests] Build completed. (364 files, 2 compiled, 1 warnings, 48.23s)

```

That warning is not new 😉 Hope that helps!

---

<div class="post-metadata">

### Author: ![thheller](https://clojureverse.org/user_avatar/clojureverse.org/thheller/32/534_2.png) [@thheller](https://clojureverse.org/u/thheller)
#### Post date: [August 1, 2023, 3:47pm UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/5 "2023-08-01T15:47:20Z")

</div>

Can’t tell what you are building unfortunately. If the tests run in `node` (e.g. `:target :node-test`) then shadow-cljs won’t be processing npm dependencies at all and therefore won’t be affected by the changes made in `2.25.*`.

Only really matters for builds where shadow-cljs actually bundles dependencies, e.g. `:target :browser`. If everything loads fine in the browser you are most likely fine. If you are testing with something that runs against an actual browser (e.g. `puppeteer`) you are likely fine too.

---

<div class="post-metadata">

### Author: ![DerGuteMoritz](https://clojureverse.org/user_avatar/clojureverse.org/dergutemoritz/32/5137_2.png) [@DerGuteMoritz](https://clojureverse.org/u/DerGuteMoritz)
#### Post date: [August 1, 2023, 4:13pm UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/6 "2023-08-01T16:13:58Z")

</div>

Ah too bad, then my result is probably not useful for you, it is indeed using `:target :node-test`.

---

<div class="post-metadata">

### Author: ![zk1](https://clojureverse.org/user_avatar/clojureverse.org/zk1/32/2171_2.png) [@zk1](https://clojureverse.org/u/zk1)
#### Post date: [August 2, 2023, 9:07pm UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/7 "2023-08-02T21:07:29Z")

</div>

Ok, updated the shadow-cljs dep in deps.edn and runtime tested the following npm libs, no issues so far.

- react-datepicker
- react-select
- autosize
- mustache
- id128
- three
- sqlite3

```auto
shadow-cljs - config: /Users/zk/code/float/edie/shadow-cljs.edn
=== Version
jar: 2.25.0
cli: 2.25.0
deps: 1.3.4
config-version: 2.25.0

=== Paths
cli: /Users/zk/code/float/edie/node_modules/shadow-cljs/cli/dist.js
config: /Users/zk/code/float/edie/shadow-cljs.edn
project: /Users/zk/code/float/edie
cache: .shadow-cljs

=== Java
openjdk version "20.0.1" 2023-04-18
OpenJDK Runtime Environment Homebrew (build 20.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 20.0.1, mixed mode, sharing)

=== Source Paths

(base) ~/code/float/edie(main*) $ bin/dev-repl 11:05:37
shadow-cljs - config: /Users/zk/code/float/edie/shadow-cljs.edn
shadow-cljs - starting via "clojure"
shadow-cljs - server version: 2.25.0 running at http://localhost:9630
shadow-cljs - nREPL server started on port 53598
shadow-cljs - watching build :browser
[:browser] Configuring build.
[:browser] Compiling ...
[:browser] Build completed. (654 files, 0 compiled, 0 warnings, 5.36s)

```

---

<div class="post-metadata">

### Author: ![pieterbreed](https://clojureverse.org/user_avatar/clojureverse.org/pieterbreed/32/3861_2.png) [@pieterbreed](https://clojureverse.org/u/pieterbreed)
#### Post date: [August 3, 2023, 8:43am UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/8 "2023-08-03T08:43:07Z")

</div>

I have a project here that is giving me new errors after the upgrade to `2.25.2`. When I add `:js-options {:use-babel true}`, these errors go away again.

## Shadow error output:

```auto
shadow-cljs - config: /some/path/shadow-cljs.edn
shadow-cljs - socket connect failed, server process dead?
shadow-cljs - starting via "clojure"
[:app] Compiling ...
Closure compilation failed with 38 errors
--- node_modules/react-easy-panzoom/src/PanZoom.js:79
Transpilation of 'Member references this or super' is not yet implemented.
--- node_modules/react-easy-panzoom/src/PanZoom.js:113
Transpilation of 'Member references this or super' is not yet implemented.
--- node_modules/react-easy-panzoom/src/PanZoom.js:124
Transpilation of 'Member references this or super' is not yet implemented.
--- node_modules/react-easy-panzoom/src/PanZoom.js:160
...

```

All the errors are only for this one file.

## after some digging …

This error occurs with a github url `package.json` dependency. We have a fork of of [https://github.com/mnogueron/react-easy-panzoom](https://github.com/mnogueron/react-easy-panzoom) which we include in `package.json` like this:

```json
        "react-easy-panzoom": "github:nette-io/react-easy-panzoom#0b44b433dac3da0ae2736a648413ef542f180dfb",

```

I experimented by removing that and doing the normal `npm install react-easy-panzoom`, which changed the `package.json` file to:

```json
        "react-easy-panzoom": "^0.4.4",

```

With the dependency specified like this, shadow-cljs compiled the project fine, so I assume the issue is somehow related to this github URL dependency.

Hope this helps.

---

<div class="post-metadata">

### Author: ![thheller](https://clojureverse.org/user_avatar/clojureverse.org/thheller/32/534_2.png) [@thheller](https://clojureverse.org/u/thheller)
#### Post date: [August 3, 2023, 11:03am UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/9 "2023-08-03T11:03:20Z")

</div>

The errors are from the Closure Compiler and a specific feature it doesn’t support. No clue which one that is in particular. Could be that either your fork added some code that triggered this, or that 0.4.4. is just newer and fixed/transpiled that code?

I just noticed that you are including the sources in the `src` dir somehow? The actual package however has the “compiled” files in `lib`. I don’t expected the sources to work directly, since they seem to be flow js with some type references. Are you maybe missing a build step in your fork?

---

<div class="post-metadata">

### Author: ![pieterbreed](https://clojureverse.org/user_avatar/clojureverse.org/pieterbreed/32/3861_2.png) [@pieterbreed](https://clojureverse.org/u/pieterbreed)
#### Post date: [August 3, 2023, 12:48pm UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/10 "2023-08-03T12:48:17Z")

</div>

Our fork changes very little and is based on `0.4.4`, so I’m assuming your second hint (missing build step) might be the avenue to persue. I’m missing some nodejs-specific knowledge here about when the build step should run or how to trigger it. I assumed that the github url dependency would somehow “just work”.

How long will the `use-babel` flag be around for? With this set to `true` we don’t have this problem, which buys us a little bit of time to sort this out.

---

<div class="post-metadata">

### Author: ![thheller](https://clojureverse.org/user_avatar/clojureverse.org/thheller/32/534_2.png) [@thheller](https://clojureverse.org/u/thheller)
#### Post date: [August 3, 2023, 1:19pm UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/11 "2023-08-03T13:19:48Z")

</div>

The lib doesn’t have build instructions, but by looking at the `package.json` I’d guess you run

```auto
npm run lib

```

> <https://github.com/mnogueron/react-easy-panzoom/blob/388b242b6a064e1f32874dbbf9e45f7441efb365/package.json#L14>

That should build the `lib` dir, with the proper .js files shadow-cljs and the closure compiler will understand. Also need to revert [this change](https://github.com/nette-io/react-easy-panzoom/commit/e0d8a8e1ae06ffd911d8794e2c3a5a73e485b533) so that the `lib` files are actually used. Looks like you also did a whole host of other changes so that shadow-cljs could build this directly, they are also probably all obsolete.

Your use of `:use-babel` is totally coincidental and not an intended feature, never was.

---

<div class="post-metadata">

### Author: ![pieterbreed](https://clojureverse.org/user_avatar/clojureverse.org/pieterbreed/32/3861_2.png) [@pieterbreed](https://clojureverse.org/u/pieterbreed)
#### Post date: [August 3, 2023, 4:07pm UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/12 "2023-08-03T16:07:39Z")

</div>

Thank you for taking the time to look and suggest changes.

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [February 2, 2024, 4:08am UTC](https://clojureverse.org/t/shadow-cljs-2-25-2-looking-for-testers/10206/13 "2024-02-02T04:08:24Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
