« Back to full topics list
0
0

The following threw the error “TypeError: Cannot find function template in object …”:

var _ = require("/modules/underscore/underscore.js"); 
var foo = _.template("");
ANSWERED
Marked as spam
Posted by - Asked on January 25, 2017 7:47 pm - 41 views

1 Replies

1
Private reply

Stefan,

While it is not straight forward to have to do something like var _ = require(“modules/underscore/ underscore.js”)._; the extra cost is only about manually exposing the needed module (the ._ at the end of the require) while the gained advantage is huge since it allows loading any library under any module name without polluting the namespace of the original scope.

Although we firmly believe in the advantage of avoiding conflicts between different libraries (or different versions of the same library) we’re also working on a feature that would allow automatically loading some variables into the main scope along with more advanced classloaders. Stay connected to blog.scriptr.io for information relating to new features we release.

Hope this helps and don’t hesitate to send any questions.

Julien Mrad
Scriptr.io

Marked as spam
Posted by - Replied on January 26, 2017 10:08 am

It works thank you

( at January 26, 2017 5:01 pm)

It worked for me. Thanks a lot!

( at November 3, 2018 3:58 pm)