user3142695 user3142695 - 8 months ago 34
Javascript Question

How to check if a Meteor package is currently installed?

I need to check if the package

is installed in my app.

Only then another template is used (which is part of this package).

Something like this:

<template name="example">
{{#if hasNotificationPackage}}

How do I do that?


Meteor provides a global object called Package that contains all of the Meteor package exports.

Therefore, you can use something like

  hasNotificationPackage() {
    return (typeof Package['my-package:notification'] === 'object');

I am not sure that depending on the availability of a package this way is something that should be used often, especially in production.