Meteor 1.3 Import Paths?


#1

Maybe I’m missing something, but code like this is confusing to me.

import { Template } from 'meteor/templating';

This statement appears to be loading the internal meteor package templating. My question is this: how do I determine the package names of internal Meteor packages so that I can reference them for importing?

My first thought was to check out meteor/packages on the main project on GitHub. However, I found, for example, this path in the Todos example app that looks like this:

import { Factory } from 'meteor/factory';

See why I’m confused again? This meteor/factory package is supposedly in Meteor core somewhere, but I can’t find a reference to it.

Can anyone tell me, definitively, how to determine import paths for core packages?


#2

All meteor packages are prefixed with ‘meteor’ to distinguish them from npm modules - both core and third-party

http://guide.meteor.com/using-packages.html#using-atmosphere

I can see how it might be confusing though, now that I think about it… since ‘meteor’ is the name of a package…


#3

Also, you can find all imports examples in the docs, just below the main section title. Example: http://docs.meteor.com/#/full/template_events

As you can see: http://guide.meteor.com/using-packages.html#using-atmosphere this is the way to import from Meteor package and in your case ‘factory’ in TODOs is just a local package name which resides in ‘/packages’ folder, but yeah it could be confusing :slight_smile:


#4

Thanks! This clears everything up nicely. :3