Getting error "Cannot find module './group_page.html'

Hi
I’m just trying out meteor 1.3.2.4 and running into some problems with loading templates. I’m trying to use flowrouter and it isn’t finding my templates.

In lib/router.js I have

import ‘…/imports/ui/pages/group_page.js’
FlowRouter.route(’/’, {
name: ‘group’,
action() {
BlazeLayout.render(‘App_body’, {main: ‘group_page’});
}
});

and then in
imports/ui/pages/group_page.js I have

import {Meteor} from ‘meteor/meteor’;
import {Template} from ‘meteor/templating’;
import {Groups} from '…/…/api/groups.js’
import ‘./group_page.html’;

This errors every time with ‘Cannot find module ./group_page.html’.

group_page.html is in the same directory (imports/ui/pages) and is just a template file.

Am I misunderstanding how the structure should work or missing something?

Many thanks
David

I ended up moving all the templates from the imports to the client directory and everything started working.

So I’ll put it down to misunderstanding how the structure should work :slight_smile:

I was getting an error like this and it was because I was trying to run client routes on the server. If you’re seeing errors related to finding *.html files in your server console, then you’re likely defining routes on the server when they should only be on the client.

This happened to me when converting an old “global-style” project to the new ES6 way and I had my router.js file formerly in lib (which is client/server before but it works) and then was trying to load it on both client and server in the new ES6 structure. I just needed to define client routes in a client-only router.js file and define server routes in a server-only router.js file. Both of these live inside /startup.

1 Like