Can't include partial - Error: No such template


So after using react for months now I have to go back to Blaze for a little, older project. For some reason I can’t get it to work anymore to load any templates/partials from subfolders.

Folder structure:

Flow router (VeliovGroup/flow-router):

FlowRouter.route('/login', {
  name: 'login',
  waitOn() { return import('./templates/login.html') },
  action() { this.render('layout', 'login') }


<template name="layout">
	{{> header}} // I also tried {{> partials/header}} or {{> ./partials/header}} - no luck!
	<main class="container-big">
		{{> yield}}

ERROR: Error: No such template: header

I don’t get it. It seems to be a very simple mistake I am making here - again, haven’t used Blaze in many many months - but I can’t find the error.
Any help please!

cheers, P


Where is header defined and where do you import the file where it is defined?


I tried just import './partials/header.html'inside a layout.js file - did not change anything.
What is the proper way to include partials when using FlowRouter?


This is not specific to FlowRouter but standard ES6. You need to make sure that your import statement covers all dependencies. So usually importing the header in layout.js would do the trick, but you also need to import layout.js. Is login.js importing layout.js?

FlowRouter.route('/login', {
  name: 'login',
  waitOn() { return import('./templates/login.js') },
  action() { this.render('layout', 'login') }


Considering it looks like there is no layout.js, I’d just add the imports to your routes file:

import './templates/layout.html'
import './templates/partials/header.js'
// header.js should then import './header.html'

FlowRouter.route('/login', {
  name: 'login',
  waitOn() { return import('./templates/login.js') },
  action() { this.render('layout', 'login') }


Or, you could go back to the eager imports that make small projects so fast to work with by removing the "meteor" key from package.json

Then you don’t need to worry about imports because everything will always be eagerly loaded.
Note: This would remove any benefit of using the dynamic import in your routes


Yep looks very likely to be an issue with incomplete imports.