_ undefined. Lodash now scoped to window.lodash solution

Solution to my problem. Adding this here should others have the same problem:

On an old site, I have a frontend built using vue.js and lodash because older browsers don’t quite support the good stuff.

I scoped lodash to _u = _.noConflict(). I always do this to protect against conflicts with other plugins etc.

Recently, the frontend stopped working… lodash was undefined. Viewing source I see that Beaver Builder now automatically scopes lodash - sticking it on the window object… it does this just after the lodash is loaded, and BEFORE my _u (hence this broke - as _ was redefined before I scoped it)

Beaver builder adds:

window.lodash = _.noConflict();

So I went through and updated all my frontend scripts, replacing _u with window.lodash - and stuff now works…

where did you see that included?

In the head - when I view source… now, on closer inspection, it looks as if the website had been updated to the latest wordpress, with guttenberg included…

It looks like guttenberg uses lodash - and scopes lodash to window.lodash.

As you’re part of the beaver builder team - could I draw your attention to my other question?

  • your other guy said I don’t need Ajax… but I really, really do… its all dynamically driven on the frontend.

Without having the entire plugin to test it isnt easy to debug a 400 error on your server. Id have to suggest testing it locally 1st so you have access to all the logs.