As the topic says, essentially I get a missing module error and I recall that back before I moved to a file structure similar to that of the Todo’s example, I used to get actual Blaze compiler errors. But now (and for some time, I must admit), whenever I’ve got a problem in an .html file, I simply get a missing module error, which is not very useful. Any ideas on how to rectify this?
I think the issue is that my files used to reside in a
.../client directory but in order to follow todos, I moved them to a folder such as
/imports/ui/components. Both .html and .js files live side-by-side and I include the html file from the .js file w/
I’m using Meteor 2.0, according to
cat .meteor/release. Couldn’t find anyone else running into this out there, which surprised me. Any ideas?
Did you also change to dynamic imports? The modules I import dynamically exhibit this behaviour
I import with: import ‘./file.html’
If any of the preceding imports are done with
import ("./whatever.js") (which in turn imports file.html) then you may be using dynamic imports - I’m not sure there is a fix for this, I run into it occasionally - it’s a little annoying not to have a trace of what the error is, but usually I’ve just made a change to the file and it’s easy enough to figure out
Yes, I import each template’s .js file in my routes.js like that. Is there a better way to do it?
I personally like that pattern as it makes your initial bundle very small. The only real downside is you lose the compile time errors.
The hacky way to resolve this would be to move all your templates to a package. Then you have a second package flagged as devOnly that imports this entire package (this gives you compile time errors when the template is invalid because in dev they are statically imported) but in prod they are dynamically imported.
However, this could be more trouble than it’s worth. For example, in dev all templates would always be available which could lead to the situation of a template that’s available in dev not being available on prod (if you forget to dynamically import it)
Arguably this is a bug in meteor and should be reported as such.
Ok yeah I see. I moved them to common code from client-only so that I could do server-side rendering.
I’ll create a report if I can get around to it. I agree it feels like a bug.