Importing Client JS files not working with Flow Router - Any ideas?


#1

Hey meteorites!

I’m having a difficult time importing client side javascript files with flow router. Without flow router, the imports work as expected but the second I introduce flow router the files aren’t loaded properly.
Here are what my files look like. Anybody out there ever experienced this ? You help is greatly appreciated :slight_smile:

client/main.js

import '../imports/startup/client'; // initialize all relevant javascript
import './main.html';

client/main.html

<head>
  <title>Welcome </title>
</head>
<template name="visitorLayout">
  <body>
    {{> Template.dynamic template=header }}
    {{> Template.dynamic template=main    }}
    {{> Template.dynamic template=footer  }}
  </body>
</template>

<template name="adminLayout">
  <body>
    {{> Template.dynamic template=main   }}
  </body>
</template>

imports/startup/client/index.js

import '../../ui/pages/landing_page/modernizr-2.6.2.min.js';
import '../../ui/pages/landing_page/jquery.easing.1.3.js';
import '../../ui/pages/landing_page/bootstrap.min.js';
import '../../ui/pages/landing_page/jquery.waypoints.min.js';
import './routes';

imports/startup/client/routes.js


import { FlowRouter  } from 'meteor/kadira:flow-router';
import { BlazeLayout } from 'meteor/kadira:blaze-layout';

FlowRouter.route('/', {
  action() {
    BlazeLayout.render('visitorLayout', {
      header : "header",
      footer : "footer",
      main   : "index"
    })
  }
});

FlowRouter.route('/admin', {
  action() {
    BlazeLayout.render('adminLayout', {
      main   : "admin"
    })
  }
});

#2

shouldn’t that be import './routes.js';?


#3

If no “.js” ending is supplied in the filename, the import statement looks for routes.js!
Any other ideas ?


#4

What does that mean exactly?


#5

Sorry for lack of clarity and thanks for you replying! ARGGGG after two days I discovered there was a bug inside a jquery plugin I was using … :frowning: Well at least I know there wasn’t anything wrong with my methodoloy. Everything works as expected now. Cheers!