require-handlebars-plugin
require-handlebars-plugin copied to clipboard
Loading template with the same name as module failed
Given I have MyModule.js and MyModule.hbs in the same folder. If I try to load MyModule.hbs from MyModule.js the requirejs gets silent at all - no errors, just nothing.
Simple example:
app/scripts/MyModule
├── MyModule.hbs
└── MyModule.js
// MyModule.js
define(['hbs!./MyModule'], function (tmpl) {
// MyModule.js not loaded
});
Same but with error. I got this in console
Error: Load timeout for modules: hbs!app/scripts/MyModule/MyModule_unnormalized12,hbs!app/scripts/MyModule/MyModule
http://requirejs.org/docs/errors.html#timeout
Where does this unnormalized12
get from?
poke @SlexAxton
same here.
Uncaught Error: Load timeout for modules: hbs!selectRace/CategoryView_unnormalized6,hbs!selectRace/CategoryView
Also getting this bug on a very small app, but on a larger one no problems. Its being served off localhost, and only happens about 1 out of every 10 page loads, so maybe its a synchronicity issue?
I've been working around this by appending -template
to all of my templates, but it's a definitely a gotcha that can take a while to debug.
Hmm, so I was working on localhost, and when I enalbed self-signed HTTPS on that local server, the problem disappeared. Maybe this is a "CORS" related issue like, [as is common[(https://github.com/requirejs/text#xhr-restrictions) with the related text! plugin?
Same problem here, so :+1:
As @dak proposed, workaround is to simply rename hbs file to avoid collision Agreed with him, it took a bit long for me to find this issue (far longer than solving it ;-))