Load underscore.js/lodash.js as extension to simplify custom javascript extension development

Gold Contributor
Gold Contributor
Hi, is that possible? Do we have simply to copy lodash code into an extension and set the scope as pre-loader? Thanks, Alessandro
3 REPLIES 3

Load underscore.js/lodash.js as extension to simplify custom javascript extension development

Employee Emeritus
Hi Alessandro, yes you can do that. The IE8-compatibility build at https://raw.githubusercontent.com/lodash/lodash/2.4.1/dist/lodash.compat.min.js is about 30Kb so that's not excessive. As you say, you can just copy and paste the whole thing into a preloader extension.

Load underscore.js/lodash.js as extension to simplify custom javascript extension development

Gold Contributor
Gold Contributor
Thank you very much Fiann!

Load underscore.js/lodash.js as extension to simplify custom javascript extension development

Gold Contributor
Gold Contributor
Hi Fiann, i tried to include lodash (precisely that one you linked) in a preloader extension, but i get an error on tealium loading: "Unexpected string" http://i.imgur.com/XoNcUht.png The error has no stack trace and it's pretty undebuggable because not event chrome can format utag.js, but i've verified that the same code (copy/pasted) it's executed well in the chrome console. What can I do to tackle the problem? Have you ever seen a similar error? In case of need I can activate to DEV the extension quicky. Thanks, Alessandro
Public