mde / ejs

Embedded JavaScript templates -- http://ejs.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

locals is not defined after upgrading the ejs to the latest version

odaper opened this issue · comments

Hello

I'm using the locals to access the variables passed to my ejs templates using yeoman v4 and ejs v2.7, for example:
<% const myParam = locals.myParam; %>
When I upgraded the ejs to the v3.1.7, the locals variables is no more defined.

How can we solve this issue? the locals is no more defined in ejs v3?

Thanks for your help

EJS by default uses with to set locally scoped versions of the variables you pass. If you want to use the locals object, you need to set the _with option to false. See the docs here: https://ejs.co/

Many thanks @mde