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 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 script, which basically just called babel. 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.