title: Cannot read property 'insert' of undefined. Am I not publishing correctly?
body: <p>My app was working perfectly till I externalized the collection definition from the <code>client/main.js</code> file to the <code>../imports/api/tasks.js</code> file. </p>
  
  <p>After this move I keep getting this error message in my browser: <code>Uncaught TypeError: Cannot read property 'insert' of undefined</code>in my browser console. This error message points to line <code>main.js:1206</code> which is:</p>
  
  <p>/myApp<br>
  ../client/main.js</p>
  
  <pre><code>import { Images } from '../imports/api/tasks.js';
  Meteor.subscribe('Images');
  
  FS.Utility.eachFile(event, function(file) {
  var teste = Images.insert(file,  function (err, fileObj) {
  
  var insertedIdSession = teste._id;
  session.set("insertedBuyId", insertedIdSession);
  Images.find().count());
  
    });
  </code></pre>
  
  <p>/myApp <br>
  ../imports/api/tasks.js</p>
  
  <pre><code>import { Mongo } from "meteor/mongo";
  Images = new FS.Collection("images", {
  stores: [new FS.Store.FileSystem("images", {path: "~/uploads"})] });
  </code></pre>
  
  <p>/myApp<br>
  ../server/main.js</p>
  
  <pre><code>import { Images } from '../imports/api/tasks.js';
  
  Meteor.publish('Images', function(){
  return Images.find();
  });
  </code></pre>
  
  <p>I have researched but failed to find a solution for this. Kind point out where i am going wrong.</p>