As mentioned in one of my previous posts, I’ve been making intensive use of Slate, an open source Javascript project, which is developed as a monorepo and published to npm.

As part of working on it I’ve had to debug some of our components and how they handle certain Slate events (especially around selection, which is a minefield in the new version).

Initially I modified the source files we used in our node_modules folder. This has obvious downsides:

  • if you reinstall your node modules all your modifications are lost
  • similarly, you can’t version control your modifications
  • published and minified files are a pain to modify - especially if they’re transpiled from something like JSX

After some trial and error, and asking around in the SlateJS Slack community, I found the solution: a package called yalc.

Yalc does something similar to npm/yarn link but handles monorepos more soundly, and follows semver for packages – it’s more like a local package registry than just a symlinking tool.

So far it’s been really useful, and it has insanely increased the feedback loop on complex selection bugs in Slate. I only regret not using it sooner.