Skip to content

Commit

Permalink
Add a small example of how Shadow CLJS can break
Browse files Browse the repository at this point in the history
At this commit, the app compiles, yet at run time the app does not
show the expected elements but instead throws a mysterious exception
that states:

    An error occurred when calling (test-evergreen.core/init)

This problem is triggered by the difference between how Shadow CLJS
resolves dependencies and how Node.js does it.

In a nutshell, Node.js supports multiple versions of a single
package within a single project; Shadow CLJS does not. And in this
short example, that makes all the difference.

In our project, we are experiencing significant pain due to this
limitation. I thought it would be worth sharing with the community a
simplified example to indicate why this constraint is difficult to
manage.

In the case of this particular commit, here are the relevant
dependencies and versions:

- our app depends on evergreen-ui at ^6.0.1 (currently the latest)
- [email protected] depends on:
  - glamor at ^2.20.40 (currently the latest) and
  - ui-box at ^4.0.0 (latest is 4.1.0)
- [email protected] depends on inline-style-prefixer at ^3.0.6
- [email protected] (the latest) depends on inline-style-prefixer at
  ^5.0.4

It turns out that inline-style-prefixer (abbreviated ISP from now
on) moved its modules around at version 5.0.0, so the way that
glamor requires ISP works for pre-v5 but not v5 and later.
Conversely, the way that ui-box requires ISP works for v5 and later
but not pre-v5.

**So there's no single version of ISP that works for both
dependencies.** And neither dependency can be easily jettisoned,
because they're both required by a dependency (evergreen-ui) that is
maintained by others.

What can we do? For starters, I've opened a PR for glamor to use a
post-v5 version of ISP. Hopefully they'll accept my PR and release a
new version soon. In the meantime, I can vendor my fork of glamor
into the repo and depend on the vendored version instead of the
version on NPM. That approach is shown in the next commit.
  • Loading branch information
kyptin committed Jun 2, 2021
0 parents commit 9ac8192
Show file tree
Hide file tree
Showing 6 changed files with 1,388 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.shadow-cljs
resources/public/js/compiled
Loading

0 comments on commit 9ac8192

Please sign in to comment.