I have a Meteor package in which I am exporting a couple of modules and I would like to use the import syntax rather than having them exist globally. Here is what I am doing in the package.js file.
Package.describe({
name: 'mycompany:mypackage',
...
});
Package.onUse(function(api) {
...
api.export('mod1', 'server');
...
}
Here is the mod1.js file.
mod1 = {};
mod1.foo = function() { console.log("foo called"); }
module.export = mod1
I can call mod1.foo in my application code since it’s a global but I would like use the import syntax. If I use this import line
import mod1 from "meteor/mycompany:mypackage/mod1"
mod1 is an empty object.