3

I'm trying to add a few simple routes to my Meteor app, it's my first time playing with FlowRouter. I installed with:

meteor add kadira:flow-router
meteor add kadira:blaze-layout

Then, I created a lib/routes.js file, containing this:

import '../imports/ui/body.js';

FlowRouter.route('/', {
  name: 'home',
  action: function(params) {
    console.log("home");
    BlazeLayout.render('body');
  }
});

The imports/ui/body.js file loads a few other templates, like so:

import './moment.js';

And moment.js imports ./moment.html, like so:

import './moment.html';

But I get this error when visiting /:

Error: Cannot find module './moment.html'

The key thing to understand is that if I bypass FlowRouter altogether, by just putting import '../imports/ui/body.js into my client/main.js file, everything works fine.

Any ideas? Help is appreciated, thank you!

nerdburn
  • 692
  • 1
  • 6
  • 10
  • 2
    Ok, after further experimentation, I've found that it works if I move `lib/routes.js` into `client/routes.js`. Maybe it was trying to run the routes on the server side and not finding my templates? – nerdburn Apr 13 '16 at 19:35

1 Answers1

0

I just ran into this same problem, but I was thinking because routes.js was in lib it would get loaded first, moving it into clients means it get loaded with the other files so it can now be found. Not sure if this is correct but as you know, it works.

macasas
  • 497
  • 6
  • 20