How to import CollectionFS

Quicky, because I’m banging my head against the wall here. I’m trying to convert everything to modules, like the meteor guide proposes. My app is using CollectionFS. How do I import the FS object in a module? Doesn’t the CollectionFS module need to be changed to support modules to make that work?

Try this:

import { FS } from 'meteor/cfs:base-package';

Tnx Tim, didn’t realize it was so straight forward. Just to help me get my head around the “imports”. Does this work aloways for every package in general? Even if their code doesn’t contain “export xyz”? Or does this only work in CFS’ case?

After messing around with it the last couple of days, finding the right import statement for each package is kind of a nightmare :slight_smile: Is there a golden rule that is applicable when importing from packages? Or is it always dependend on the package author? (e.g., does the CFS example above, work with every package?)

It depends on the package. To find the CollectionFS one I hunted around in the package source. It’s different because CollectionFS is broken into many smaller packages whereas often it’s just a single one.

Usually, however, they follow a fairly general form of meteor/package-author:package-name

import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { FlowRouter } from 'meteor/kadira:flow-router-ssr';