How import xyz:loading when not explained

This is probably a very basic question, but it’s something that I haven’t figured out. I’ve recently added a new module to my Meteor application like this:

$ meteor add xyz:loading

However, the documentation for this package doesn’t give an example of how to import it. I’ve tried:

import XYZ from "xyz:loading"

but that doesn’t work. I get an “unable to resolve module” error.

Usually, the documentation for a package shows how the package should be imported. But when it doesn’t, how can I figure this out?

PS: I am using this package to display a busy cursor while invoking a Meteor method. Is there a better way?

Meteor packages need to be namespaced. You can try to import it like this:

import {XYZ} from 'meteor/xyz:loading';

Ok. Thanks.

But before I got your response, I just tried to access the module without first importing it, like this:

Loading.call(methodToCall, subject, (error, subjectId) => {
      if (error) {

And it worked. Why didn’t I have to import it?

You are probably thinking that I’m not a very experienced Meteor/JavaScript programming. You would be right.

Hey @crirvine,

The reason you don’t have to import it is because in the package definition file of xyz:loading, they call api.export('Loading', 'client').

What that does is makes that variable or exported symbol available globally, kind of like how Meteor is available without imports

Package definition: https://github.com/foxbenjaminfox/meteor-loading/blob/master/package.js#L16
api.export docs: https://docs.meteor.com/api/packagejs.html#PackageAPI-export