Compiling with the latest CanJS version if a version isn't specified causes unexpected breakage
onyxrev opened this issue · 3 comments
I struggled for several hours with a compilation bug that popped up suddenly. The templates we've compiled successfully for months stopped working. Today I discovered that even though we've been running CanJS 2.0.7 and we haven't upgraded, can compile was remote-fetching 2.1 (latest) and compiling the templates with that code. And, then, when we ran those compiled templates against our 2.0.7 codebase it breaks (although a surprising amount of it still works).
2.1 only came out a few days ago so of course we haven't upgraded.
The solution is to specify a 'version' in the grunt config like so:
cancompile: {
dist: {
src: [mediaDirectory + '/templates/*.mustache'],
out: jsBaseDirectory + '/views.production.js',
wrapper: 'define(["can/view/mustache"], function(can) { {{{content}}} });',
version: '2.0.7'
}
But this behavior was totally unexpected and threw everyone for a loop because we didn't change a thing.
This should at least be called out as a mandatory parameter in the documentation.
Sorry. I could have saved you some time if I would have posted this as a separate issue. It would have helped to use my head a little bit more. I had the same thing happen a couple of hours after CanJS 2.1 was released. I’ve been trying to figure out a solution for using 2.1, but I don’t have a lot to show in the way of progress:
Have a great day!
Marshall Thompson
On May 10, 2014 at 11:39:08 PM, Dan Connor (notifications@github.com) wrote:
I struggled for several hours with a compilation bug that popped up suddenly. The templates we've compiled successfully for months stopped working. Today I discovered that even though we've been running CanJS 2.0.7 and we haven't upgraded, can compile was remote-fetching 2.1 (latest) and compiling the templates with that code. And, then, when we ran those compiled templates against our 2.0.7 codebase it breaks (although a surprising amount of it still works).
The solution is to specify a 'version' in the grunt config like so:
cancompile: {
dist: {
src: [mediaDirectory + '/templates/*.mustache'],
out: jsBaseDirectory + '/views.production.js',
wrapper: 'define(["can/view/mustache"], function(can) { {{{content}}} });',
version: '2.0.7'
}
But this behavior was totally unexpected and threw everyone for a loop because we didn't change a thing.
This should at least be called out as a mandatory parameter in the documentation.
—
Reply to this email directly or view it on GitHub.
Making the version parameter mandatory makes sense (it was breaking for me, too). I will do that with the next release and also make sure that 2.1 works.