What's involved integrating a new front-end library with Meteor?

Are there any examples of what’s involved when trying to integrate a new front-end library with Meteor? Even just the basics and a less than 100% integration?

Trying to figure out if it is something to be attempted or wait for a major contributor to try and do.

Thanks!

There are two main aspects:

  1. Many front-end libraries have their own syntax, so you would need to create a Meteor build plugin to compile the files
  2. Finding a way to integrate with Tracker

For the build plugin, I think the simplest example would be the svelte:compiler package, and for HMR you can look at my fork of it. I’ve been writing a series of blog posts about creating a new front-end library for Meteor based on Blaze.

A lot of the code is the same between most Meteor compiler packages. The front-end library should have an npm package with its compiler, so the Meteor compiler package would mostly take care of caching and passing the file content to the compiler for the front-end library. Depending on the front-end library the Meteor package might also handle integrating with HMR and passing the compiled output to Meteor’s babel compiler to support older web browsers and new syntax.

How to integrate tracker varies quite a bit between each front-end library, and depending on your project and the library might not even be needed. Usually it requires finding a simple way for developers to create Tracker computations using Tracker.autorun, a way to invalidate the computation when any component state it uses changes, and a way to update the component when the computation is re-ran.

Some of the tracker integrations are:

7 Likes

Awesome, thanks so much, that’s a really helpful reply. Your blog posts looks fantastic, looking forward to reading through them!

This would be for Imba v2 (I have already discussed this briefly with its creator Sindre Aarsaether)

I think he briefly worked on an implementation for v1 and hopefully will have time at some future point to look at an integration for v2.

I’m hopeful there will be some similarities with Svelte due to them both being compilers. Imba also re-renders on every change so hopefully that may alleviate some of the need for certain integrations (though I’m not certain).

Either way would be fun to integrate as v2 is going to be incredible and would be a nice alternative to React/Vue/Svelte

Great answer! We made the move from Blaze to svelte not to long ago…and its a DREAM COME TRUE!

1 Like