Meteor 2.4 And New Meteor Installer

Version 2.4 brings you new features, performance improvements, and a new installer.

You probably know that Meteor has had a few different installers during the years. Our most recent update allowed Meteor users on Windows to use NPM to install Meteor.

Now we are enabling this option for Unix & macOS, and we’re happy to announce the new way to install Meteor:

npm i -g meteor

Yes, it’s that simple. Just an easy npm install and you are ready to go. Read more about this installer in our docs.

Continue reading for other news in Meteor 2.4.

Windows improvements

Some Meteor commands were hanging on Windows and we finally isolated the problem. This problem was caused by the native file watcher library that we’re using, but in many cases, this watcher was not necessary.

One case that was happening very often was in the meteor create command, specifically after the first install. Now, this command is not using this library and meteor create shouldn’t hang anymore in Windows.

We’re researching another library to fix this problem in the long term but for now, we should be good with this workaround.

New collection method: createIndex

Following the deprecation and removal of ensureIndex method in MongoDB 5, we are making first step towards this MongoDB release by deprecating our own _ensureIndex method on collections and replacing it with createIndex.

There are no changes in the behavior so you can use createIndex as you were using _ensureIndex before. Behind the scenes Collection _ensureIndex is using the same implementation as createIndex so both are safe to use.

Email: custom transport and known services

In version 2.2 of the email package, we are adding two new features.

First Email.customTransport which allows you to override the sending functionality with your own handling. This way you can stop sending emails via SMTP that you set in MAIL_URL env var and instead use API provided specifically by the service you use. Read the docs for more details.

Second is the option to use Meteor.settings.packages.email to set options for sending to known services without the need for MAIL_URL env var and you having to find all the details. You just need to provide the name of the known service, user and password in the settings and the package is going to take care of the rest.

Make sure to check over the updated email documentation for all the implementation details.

The MAIL_URL env var is still going to work and we have no plans to deprecate it.

Runtime Performance Improvements

The latest version of reify reduces the overhead of import statements and some uses of export ... from, especially when a module is imported a large number of times or re-exports a large number of exports from other modules.

The benefits are clear when working with huge libraries like @material-ui/icons, you can read more details in the PRs. 1, 2

This optimization opens the door for us to resume the work in Tree-shaking as huge libraries are not a big problem for us in development anymore and Tree-shaking can now be enabled only for production builds.

Publications Fine Tune

Publications can now use different strategies in the way it uses the mergebox. You can tune the behavior so that you can better manage bandwidth usage and server-side memory. There are 3 strategies available SERVER_MERGE, NO_MERGE and NO_MERGE_NO_HISTORY to choose from.

Keeping it simple:
SERVER_MERGE: Default Meteor behavior, nothing new here.

NO_MERGE_NO_HISTORY: Should only be chosen for special use cases like send-and-forget queues.

NO_MERGE: Remembers only the IDs sent to the client and applies new rules when adding, updating, and removing documents into Minimongo.

These strategies are selected for each publication so you can have a mix of them in your app, choosing the best strategy for each scenario. It will be nice to see new ways to combine publications emerging from the community now that we have different options available. Read all the details in the docs.

Vue 3 integration

Since July we started to use GitHub Discussions to discuss ideas and feature requests for Meteor.

At this moment the #1 discussion is the discussion about Vue 3 integration and we are happy to announce the first version of this integration!

If you want to help with testing the integration you can install the package, read the docs and give it a try:

meteor add vuejs:vue3

Apollo server 3

For those who are already running on Apollo server v2 and would like to quickly know how to upgrade, these is an article how to do so, but keep in mind that based on what features you are using, you might need to do much more work and as such you should consult the Apollo upgrade guide.

Runtime configuration hooks

The latest webapp package now allows you to create a runtime config hooks that get called when runtime config is set or changes.

For example, in some cases, it is valuable to be able to control the __meteor_runtime_config__ variable that initializes Meteor at runtime.

There are occasions when a single Meteor server would like to serve multiple Cordova applications that each have a unique ROOT_URL. But there are two problems:

  1. Meteor server can only be configured to serve a single ROOT_URL.

  2. Cordova applications are build-time configured with a specific ROOT_URL.

These two conditions break autoupdate for Cordova applications. cordova-plugin-meteor-webapp will fail the update if the ROOT_URL from the server does not match the build time configured ROOT_URL of the Cordova application.

To remedy this problem webapp has now a few hooks for dynamically configuring __meteor_runtime_config__ on the server.

These are:
WebApp.addRuntimeConfigHook
WebApp.addUpdatedConfigHook
WebApp.decodeRuntimeConfig
WebApp.encodeRuntimeConfig

Read more in the docs.

Facebook OAuth login handler

facebook-oauth now features a new login handler hook same as the one for Google package which should make it easier for you to retrieve data if you are using React Native and similar tools. Read more

Typescript upgrade

Typescript update to v4.3.5 is a patch release with a bug fix for auto-imports in JSX components.

And much more!

There were many other smaller improvements and updates made for this release like updated dependencies for minifiers and bug fixes that are either part of this release or were released independently in their respective packages. Make sure to read the full changelog for a list of all the details and upgrade to Meteor 2.4 by running meteor update in your app directory!

If you have any questions for us, feel free to reach out in the Forums, or to [email protected].

If you like my work, please support me on GitHub Sponsors ❤️.

20